Skip to content

Commit

Permalink
Twenty Nineteen: Fixes and improvements.
Browse files Browse the repository at this point in the history
This commit brings over several changes that occurred upstream in the theme’s GitHub repository into core.

- Fix the gallery caption link color. WordPress/twentynineteen#687
- Remove left padding from pullquote blocks. WordPress/twentynineteen#690
- Print `skip-link-focus-fix` inline instead of enqueueing as blocking script. https://github
.com/WordPress/twentynineteen/pull/47
- Fix and improve some strings with placeholders. WordPress/twentynineteen#217
- Fixes some minor code quality issues. WordPress/twentynineteen#237
- Fix PHP Warning: Parameter must be an array or an object that implements Countable. https://github
.com/WordPress/twentynineteen/pull/661
- Add missing text domain and escaping to comment author text. WordPress/twentynineteen#274
- Remove hyphens rule for cover image text. WordPress/twentynineteen#691
- Fix left/right-aligned pullquote spacing. WordPress/twentynineteen#695
- Improve `readme.txt` to follow the correct standards for themes. WordPress/twentynineteen#689

Props kjellr, allancole, dimadin, westonruter, khleomix, grapplerulrich, iCaleb, desrosj.

Merges [44196], [44199], and [44201-44202] into trunk.

Fixes #45424.

git-svn-id: https://develop.svn.wordpress.org/trunk@44305 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
desrosj committed Dec 18, 2018
1 parent bf515b7 commit 80c9922
Show file tree
Hide file tree
Showing 14 changed files with 153 additions and 109 deletions.
Expand Up @@ -33,10 +33,10 @@ protected function html5_comment( $comment, $depth, $args ) {
<footer class="comment-meta">
<div class="comment-author vcard">
<?php
$comment_author_link = get_comment_author_link( $comment );
$comment_author_url = get_comment_author_url( $comment );
$comment_author = get_comment_author( $comment );
$avatar = get_avatar( $comment, $args['avatar_size'] );
$comment_author_link = get_comment_author_link( $comment );
$comment_author_url = get_comment_author_url( $comment );
$comment_author = get_comment_author( $comment );
$avatar = get_avatar( $comment, $args['avatar_size'] );
if ( 0 != $args['avatar_size'] ) {
if ( empty( $comment_author_url ) ) {
echo $avatar;
Expand All @@ -45,21 +45,34 @@ protected function html5_comment( $comment, $depth, $args ) {
echo $avatar;
}
}
/*
* Using the `check` icon instead of `check_circle`, since we can't add a
* fill color to the inner check shape when in circle form.
*/
if ( twentynineteen_is_comment_by_post_author( $comment ) ) {
printf( '<span class="post-author-badge" aria-hidden="true">%s</span>', twentynineteen_get_icon_svg( 'check', 24 ) );
}

/*
* Using the `check` icon instead of `check_circle`, since we can't add a
* fill color to the inner check shape when in circle form.
*/
/*
* Using the `check` icon instead of `check_circle`, since we can't add a
* fill color to the inner check shape when in circle form.
*/
if ( twentynineteen_is_comment_by_post_author( $comment ) ) {
/* translators: %s: SVG Icon */
printf( '<span class="post-author-badge" aria-hidden="true">%s</span>', twentynineteen_get_icon_svg( 'check', 24 ) );
}

printf(
/* translators: %s: comment author link */
printf(
/* translators: %s: comment author link */
wp_kses(
__( '%s <span class="screen-reader-text says">says:</span>', 'twentynineteen' ),
sprintf( '<span class="fn">%s</span>', $comment_author )
);
array(
'span' => array(
'class' => array(),
),
)
),
'<b class="fn">' . get_comment_author_link( $comment ) . '</b>'
);

if ( ! empty( $comment_author_url ) ) {
echo '</a>';
Expand Down Expand Up @@ -110,5 +123,4 @@ protected function html5_comment( $comment, $depth, $args ) {
?>
<?php
}

}
20 changes: 18 additions & 2 deletions src/wp-content/themes/twentynineteen/functions.php
Expand Up @@ -221,8 +221,6 @@ function twentynineteen_scripts() {

wp_style_add_data( 'twentynineteen-style', 'rtl', 'replace' );

wp_enqueue_script( 'twentynineteen-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );

if ( has_nav_menu( 'menu-1' ) ) {
wp_enqueue_script( 'twentynineteen-priority-menu', get_theme_file_uri( '/js/priority-menu.js' ), array(), '1.0', true );
wp_enqueue_script( 'twentynineteen-touch-navigation', get_theme_file_uri( '/js/touch-keyboard-navigation.js' ), array(), '1.0', true );
Expand All @@ -236,6 +234,24 @@ function twentynineteen_scripts() {
}
add_action( 'wp_enqueue_scripts', 'twentynineteen_scripts' );

/**
* Fix skip link focus in IE11.
*
* This does not enqueue the script because it is tiny and because it is only for IE11,
* thus it does not warrant having an entire dedicated blocking script being loaded.
*
* @link https://git.io/vWdr2
*/
function twentynineteen_skip_link_focus_fix() {
// The following is minified via `terser --compress --mangle -- js/skip-link-focus-fix.js`.
?>
<script>
/(trident|msie)/i.test(navigator.userAgent)&&document.getElementById&&window.addEventListener&&window.addEventListener("hashchange",function(){var t,e=location.hash.substring(1);/^[A-z0-9_-]+$/.test(e)&&(t=document.getElementById(e))&&(/^(?:a|select|input|button|textarea)$/i.test(t.tagName)||(t.tabIndex=-1),t.focus())},!1);
</script>
<?php
}
add_action( 'wp_print_footer_scripts', 'twentynineteen_skip_link_focus_fix' );

/**
* Enqueue supplemental block editor styles.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/wp-content/themes/twentynineteen/header.php
Expand Up @@ -37,7 +37,7 @@
$discussion = ! is_page() && twentynineteen_can_show_post_thumbnail() ? twentynineteen_get_discussion_data() : null;

$classes = 'entry-header';
if ( ! empty( $discussion ) && count( $discussion->responses ) > 0 ) {
if ( ! empty( $discussion ) && absint( $discussion->responses ) > 0 ) {
$classes = 'entry-header has-discussion';
}
?>
Expand Down
6 changes: 3 additions & 3 deletions src/wp-content/themes/twentynineteen/inc/template-tags.php
Expand Up @@ -40,8 +40,8 @@ function twentynineteen_posted_on() {
*/
function twentynineteen_posted_by() {
printf(
'<span class="byline">%1$s<span class="screen-reader-text">%2$s</span><span class="author vcard"><a class="url fn n" href="%3$s">%4$s</a></span></span>',
/* translators: 1: SVG icon. 2: post author, only visible to screen readers. 3: author link. */
'<span class="byline">%1$s<span class="screen-reader-text">%2$s</span><span class="author vcard"><a class="url fn n" href="%3$s">%4$s</a></span></span>',
twentynineteen_get_icon_svg( 'person', 16 ),
__( 'Posted by', 'twentynineteen' ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
Expand Down Expand Up @@ -85,8 +85,8 @@ function twentynineteen_entry_footer() {
/* translators: used between list items, there is a space after the comma. */
$categories_list = get_the_category_list( __( ', ', 'twentynineteen' ) );
if ( $categories_list ) {
/* translators: 1: SVG icon. 2: posted in label, only visible to screen readers. 3: list of categories. */
printf(
/* translators: 1: SVG icon. 2: posted in label, only visible to screen readers. 3: list of categories. */
'<span class="cat-links">%1$s<span class="screen-reader-text">%2$s</span>%3$s</span>',
twentynineteen_get_icon_svg( 'archive', 16 ),
__( 'Posted in', 'twentynineteen' ),
Expand All @@ -97,8 +97,8 @@ function twentynineteen_entry_footer() {
/* translators: used between list items, there is a space after the comma. */
$tags_list = get_the_tag_list( '', __( ', ', 'twentynineteen' ) );
if ( $tags_list ) {
/* translators: 1: SVG icon. 2: posted in label, only visible to screen readers. 3: list of tags. */
printf(
/* translators: 1: SVG icon. 2: posted in label, only visible to screen readers. 3: list of tags. */
'<span class="tags-links">%1$s<span class="screen-reader-text">%2$s </span>%3$s</span>',
twentynineteen_get_icon_svg( 'tag', 16 ),
__( 'Tags:', 'twentynineteen' ),
Expand Down
Expand Up @@ -3,6 +3,8 @@
*
* Helps with accessibility for keyboard only users.
*
* This is the source file for what is minified in the twentynineteen_skip_link_focus_fix() PHP function.
*
* Learn more: https://git.io/vWdr2
*/
( function() {
Expand Down
76 changes: 17 additions & 59 deletions src/wp-content/themes/twentynineteen/readme.txt
@@ -1,64 +1,22 @@
# Twenty Nineteen
=== Twenty Nineteen ===
Contributors: the WordPress team
Tags: one-column, flexible-header, accessibility-ready, custom-colors, custom-menu, custom-logo, editor-style, featured-images, footer-widgets, rtl-language-support, sticky-post, theme-options, threaded-comments, translation-ready
Requires at least: 4.9.6
Tested up to: 5.0
Stable tag: 1.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

[![Build Status](https://travis-ci.org/WordPress/twentynineteen.svg?branch=master)](https://travis-ci.org/WordPress/twentynineteen)
Our 2019 default theme is designed to show off the power of the block editor.

**Contributors:** the WordPress team
**Requires at least:** WordPress 4.9.6
**Tested up to:** WordPress 4.9.8
**Version:** 1.0
**License:** GPLv2 or later
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html
**Tags:** one-column, flexible-header, accessibility-ready, custom-colors, custom-menu, custom-logo, editor-style, featured-images, footer-widgets, rtl-language-support, sticky-post, theme-options, threaded-comments, translation-ready
== Description ==
Our 2019 default theme is designed to show off the power of the block editor. It features custom styles for all the default blocks, and is built so that what you see in the editor looks like what you'll see on your website. Twenty Nineteen is designed to be adaptable to a wide range of websites, whether you’re running a photo blog, launching a new business, or supporting a non-profit. Featuring ample whitespace and modern sans-serif headlines paired with classic serif body text, it's built to be beautiful on all screen sizes.

## Description
== Changelog ==

Twenty Nineteen is a Gutenberg-ready theme for WordPress.
= 1.0 =
* Initial Release

## Installation

1. In your admin panel, go to Appearance -> Themes and click the 'Add New' button.
2. Type in Twenty Nineteen in the search form and press the 'Enter' key on your keyboard.
3. Click on the 'Activate' button to use your new theme right away.
4. Go to https://codex.wordpress.org/Twenty_Nineteen for a guide on how to customize this theme.
5. Navigate to Appearance > Customize in your admin panel and customize to taste.

## Copyright

Twenty Nineteen WordPress Theme, Copyright 2018 WordPress.org
Twenty Nineteen is distributed under the terms of the GNU GPL.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

Twenty Nineteen bundles the following third-party resources:

_s, Copyright 2015-2018 Automattic, Inc.
**License:** GPLv2 or later
Source: https://github.com/Automattic/_s/

normalize.css, Copyright 2012-2016 Nicolas Gallagher and Jonathan Neal
**License:** MIT
Source: https://necolas.github.io/normalize.css/

Bundled header image 1, Copyright XXXXX XXXXX
**License:** CC0 1.0 Universal (CC0 1.0)
Source: https://pexels.com/xxxxxxxxxx

Bundled header image 2, Copyright XXXXX XXXXX
**License:** CC0 1.0 Universal (CC0 1.0)
Source: https://pexels.com/xxxxxxxxxx

## Changelog

### 1.0

* Released: December 6, 2018

Initial release
== Resources ==
* normalize.css, © 2012-2018 Nicolas Gallagher and Jonathan Neal, MIT
* Underscores, © 2012-2018 Automattic, Inc., GNU GPL v2 or later
28 changes: 21 additions & 7 deletions src/wp-content/themes/twentynineteen/sass/blocks/_blocks.scss
Expand Up @@ -324,6 +324,7 @@
margin-top: calc(4 * #{ $size__spacing-unit});
margin-bottom: calc(4.33 * #{ $size__spacing-unit});
margin-right: 0;
padding-left: 0;
}

p {
Expand Down Expand Up @@ -362,10 +363,14 @@
padding: 0;

blockquote {
margin-left: 0;
margin: $size__spacing-unit 0;
padding: 0;
text-align: left;
max-width: 100%;

p:first-child {
margin-top: 0;
}
}
}

Expand Down Expand Up @@ -399,10 +404,11 @@
}

blockquote {
max-width: calc(100% - (2 * #{$size__spacing-unit}));
max-width: 100%;
color: $color__background-body;
padding-left: 0;
margin-left: $size__spacing-unit;
margin-right: $size__spacing-unit;

&.has-text-color p,
&.has-text-color a,
Expand All @@ -420,6 +426,14 @@
}
}

&.alignright,
&.alignleft {

@include media(tablet) {
padding: $size__spacing-unit calc(2 * #{$size__spacing-unit});
}
}

&.alignfull {

@include media(tablet) {
Expand Down Expand Up @@ -528,10 +542,6 @@
line-height: 1.25;
padding: 0;
color: #fff;
-ms-hyphens: auto;
-moz-hyphens: auto;
-webkit-hyphens: auto;
hyphens: auto;

@include media(tablet) {
font-size: $font__size-xl;
Expand All @@ -544,7 +554,7 @@
width: 100%;

@include media(tablet) {
padding: $size__spacing-unit;
padding: $size__spacing-unit calc(2 * #{$size__spacing-unit});
}
}

Expand Down Expand Up @@ -578,6 +588,10 @@
.blocks-gallery-item:last-child {
margin-bottom: 16px;
}

figcaption a {
color: #fff;
}
}

//! Captions
Expand Down
3 changes: 2 additions & 1 deletion src/wp-content/themes/twentynineteen/single.php
Expand Up @@ -27,7 +27,8 @@
// Parent post navigation.
the_post_navigation(
array(
'prev_text' => _x( '<span class="meta-nav">Published in</span><br/><span class="post-title">%title</span>', 'Parent post link', 'twentynineteen' ),
/* translators: %s: parent post link */
'prev_text' => sprintf( __( '<span class="meta-nav">Published in</span><span class="post-title">%s</span>', 'twentynineteen' ), '%title' ),
)
);
} elseif ( is_singular( 'post' ) ) {
Expand Down
11 changes: 9 additions & 2 deletions src/wp-content/themes/twentynineteen/style-editor.css
Expand Up @@ -332,12 +332,19 @@ figcaption,
.wp-block[data-type="core/cover"][data-align="right"] .wp-block-cover {
width: 100%;
max-width: 100%;
padding: calc(1.375 * 1rem);
}

.wp-block[data-type="core/cover"][data-align="left"] .wp-block-cover p,
.wp-block[data-type="core/cover"][data-align="right"] .wp-block-cover p {
padding-left: 0;
padding-right: 0;
}

@media only screen and (min-width: 768px) {
.wp-block[data-type="core/cover"][data-align="left"] .wp-block-cover,
.wp-block[data-type="core/cover"][data-align="right"] .wp-block-cover {
padding: 1rem;
padding: calc(2.75 * 1rem) calc(2.75 * 1rem) calc(3.125 * 1rem);
}
}

Expand Down Expand Up @@ -760,5 +767,5 @@ ul.wp-block-archives li ul,

/* Make sure our non-latin font overrides don't overwrite the iconfont used in the classic editor toolbar */
.wp-block[data-type="core/freeform"] .mce-btn i {
font-family: dashicons !important;
font-family: dashicons !important;
}
11 changes: 7 additions & 4 deletions src/wp-content/themes/twentynineteen/style-editor.scss
Expand Up @@ -294,12 +294,15 @@ figcaption,
.wp-block-cover {
width: 100%;
max-width: 100%;
}
padding: calc(1.375 * #{$size__spacing-unit});

@include media(tablet) {
p {
padding-left: 0;
padding-right: 0;
}

.wp-block-cover {
padding: $size__spacing-unit;
@include media(tablet) {
padding: calc(2.75 * #{$size__spacing-unit}) calc(2.75 * #{$size__spacing-unit}) calc(3.125 * #{$size__spacing-unit});
}
}
}
Expand Down

0 comments on commit 80c9922

Please sign in to comment.