diff options
Diffstat (limited to 'themes/twentyfifteen')
24 files changed, 951 insertions, 782 deletions
diff --git a/themes/twentyfifteen/archive.php b/themes/twentyfifteen/archive.php index bb6021e3..26a9a4b4 100644 --- a/themes/twentyfifteen/archive.php +++ b/themes/twentyfifteen/archive.php @@ -9,7 +9,7 @@ * new template file for each one. For example, tag.php (Tag archives), * category.php (Category archives), author.php (Author archives), etc. * - * @link https://codex.wordpress.org/Template_Hierarchy + * @link https://developer.wordpress.org/themes/basics/template-hierarchy/ * * @package WordPress * @subpackage Twenty_Fifteen @@ -32,7 +32,8 @@ get_header(); ?> <?php // Start the Loop. - while ( have_posts() ) : the_post(); + while ( have_posts() ) : + the_post(); /* * Include the Post-Format-specific template for the content. @@ -41,17 +42,19 @@ get_header(); ?> */ get_template_part( 'content', get_post_format() ); - // End the loop. + // End the loop. endwhile; // Previous/next page navigation. - the_posts_pagination( array( - 'prev_text' => __( 'Previous page', 'twentyfifteen' ), - 'next_text' => __( 'Next page', 'twentyfifteen' ), - 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>', - ) ); + the_posts_pagination( + array( + 'prev_text' => __( 'Previous page', 'twentyfifteen' ), + 'next_text' => __( 'Next page', 'twentyfifteen' ), + 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>', + ) + ); - // If no content, include the "No posts found" template. + // If no content, include the "No posts found" template. else : get_template_part( 'content', 'none' ); diff --git a/themes/twentyfifteen/comments.php b/themes/twentyfifteen/comments.php index 6b97ec39..b7ab478a 100644 --- a/themes/twentyfifteen/comments.php +++ b/themes/twentyfifteen/comments.php @@ -26,23 +26,23 @@ if ( post_password_required() ) { <h2 class="comments-title"> <?php $comments_number = get_comments_number(); - if ( '1' === $comments_number ) { - /* translators: %s: post title */ - printf( _x( 'One thought on “%s”', 'comments title', 'twentyfifteen' ), get_the_title() ); - } else { - printf( - /* translators: 1: number of comments, 2: post title */ - _nx( - '%1$s thought on “%2$s”', - '%1$s thoughts on “%2$s”', - $comments_number, - 'comments title', - 'twentyfifteen' - ), - number_format_i18n( $comments_number ), - get_the_title() - ); - } + if ( '1' === $comments_number ) { + /* translators: %s: post title */ + printf( _x( 'One thought on “%s”', 'comments title', 'twentyfifteen' ), get_the_title() ); + } else { + printf( + /* translators: 1: number of comments, 2: post title */ + _nx( + '%1$s thought on “%2$s”', + '%1$s thoughts on “%2$s”', + $comments_number, + 'comments title', + 'twentyfifteen' + ), + number_format_i18n( $comments_number ), + get_the_title() + ); + } ?> </h2> @@ -50,11 +50,13 @@ if ( post_password_required() ) { <ol class="comment-list"> <?php - wp_list_comments( array( - 'style' => 'ol', - 'short_ping' => true, - 'avatar_size' => 56, - ) ); + wp_list_comments( + array( + 'style' => 'ol', + 'short_ping' => true, + 'avatar_size' => 56, + ) + ); ?> </ol><!-- .comment-list --> @@ -64,9 +66,9 @@ if ( post_password_required() ) { <?php // If comments are closed and there are comments, let's leave a little note, shall we? - if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : - ?> - <p class="no-comments"><?php _e( 'Comments are closed.', 'twentyfifteen' ); ?></p> + if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : + ?> + <p class="no-comments"><?php _e( 'Comments are closed.', 'twentyfifteen' ); ?></p> <?php endif; ?> <?php comment_form(); ?> diff --git a/themes/twentyfifteen/content-link.php b/themes/twentyfifteen/content-link.php index 2beb1f78..f9a31997 100644 --- a/themes/twentyfifteen/content-link.php +++ b/themes/twentyfifteen/content-link.php @@ -15,39 +15,43 @@ <header class="entry-header"> <?php - if ( is_single() ) : - the_title( sprintf( '<h1 class="entry-title"><a href="%s">', esc_url( twentyfifteen_get_link_url() ) ), '</a></h1>' ); + if ( is_single() ) : + the_title( sprintf( '<h1 class="entry-title"><a href="%s">', esc_url( twentyfifteen_get_link_url() ) ), '</a></h1>' ); else : the_title( sprintf( '<h2 class="entry-title"><a href="%s">', esc_url( twentyfifteen_get_link_url() ) ), '</a></h2>' ); endif; - ?> + ?> </header> <!-- .entry-header --> <div class="entry-content"> <?php /* translators: %s: Name of current post */ - the_content( sprintf( - __( 'Continue reading %s', 'twentyfifteen' ), - the_title( '<span class="screen-reader-text">', '</span>', false ) - ) ); + the_content( + sprintf( + __( 'Continue reading %s', 'twentyfifteen' ), + the_title( '<span class="screen-reader-text">', '</span>', false ) + ) + ); - wp_link_pages( array( - 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfifteen' ) . '</span>', - 'after' => '</div>', - 'link_before' => '<span>', - 'link_after' => '</span>', - 'pagelink' => '<span class="screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>%', - 'separator' => '<span class="screen-reader-text">, </span>', - ) ); - ?> + wp_link_pages( + array( + 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfifteen' ) . '</span>', + 'after' => '</div>', + 'link_before' => '<span>', + 'link_after' => '</span>', + 'pagelink' => '<span class="screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>%', + 'separator' => '<span class="screen-reader-text">, </span>', + ) + ); + ?> </div> <!-- .entry-content --> <?php // Author bio. - if ( is_single() && get_the_author_meta( 'description' ) ) : - get_template_part( 'author-bio' ); + if ( is_single() && get_the_author_meta( 'description' ) ) : + get_template_part( 'author-bio' ); endif; ?> diff --git a/themes/twentyfifteen/content-none.php b/themes/twentyfifteen/content-none.php index f1d59be4..cf118d21 100644 --- a/themes/twentyfifteen/content-none.php +++ b/themes/twentyfifteen/content-none.php @@ -2,7 +2,7 @@ /** * The template part for displaying a message that posts cannot be found * - * Learn more: {@link https://codex.wordpress.org/Template_Hierarchy} + * Learn more: {@link https://developer.wordpress.org/themes/basics/template-hierarchy/} * * @package WordPress * @subpackage Twenty_Fifteen diff --git a/themes/twentyfifteen/content-page.php b/themes/twentyfifteen/content-page.php index 7d37daa7..5b9e796c 100644 --- a/themes/twentyfifteen/content-page.php +++ b/themes/twentyfifteen/content-page.php @@ -21,15 +21,17 @@ <div class="entry-content"> <?php the_content(); ?> <?php - wp_link_pages( array( - 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfifteen' ) . '</span>', - 'after' => '</div>', - 'link_before' => '<span>', - 'link_after' => '</span>', - 'pagelink' => '<span class="screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>%', - 'separator' => '<span class="screen-reader-text">, </span>', - ) ); - ?> + wp_link_pages( + array( + 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfifteen' ) . '</span>', + 'after' => '</div>', + 'link_before' => '<span>', + 'link_after' => '</span>', + 'pagelink' => '<span class="screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>%', + 'separator' => '<span class="screen-reader-text">, </span>', + ) + ); + ?> </div><!-- .entry-content --> <?php edit_post_link( __( 'Edit', 'twentyfifteen' ), '<footer class="entry-footer"><span class="edit-link">', '</span></footer><!-- .entry-footer -->' ); ?> diff --git a/themes/twentyfifteen/content-search.php b/themes/twentyfifteen/content-search.php index 33e2d993..faa79f50 100644 --- a/themes/twentyfifteen/content-search.php +++ b/themes/twentyfifteen/content-search.php @@ -2,7 +2,7 @@ /** * The template part for displaying results in search pages * - * Learn more: {@link https://codex.wordpress.org/Template_Hierarchy} + * Learn more: {@link https://developer.wordpress.org/themes/basics/template-hierarchy/} * * @package WordPress * @subpackage Twenty_Fifteen diff --git a/themes/twentyfifteen/content.php b/themes/twentyfifteen/content.php index 24756007..1ac377af 100644 --- a/themes/twentyfifteen/content.php +++ b/themes/twentyfifteen/content.php @@ -18,37 +18,41 @@ <header class="entry-header"> <?php - if ( is_single() ) : - the_title( '<h1 class="entry-title">', '</h1>' ); + if ( is_single() ) : + the_title( '<h1 class="entry-title">', '</h1>' ); else : the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); endif; - ?> + ?> </header><!-- .entry-header --> <div class="entry-content"> <?php /* translators: %s: Name of current post */ - the_content( sprintf( - __( 'Continue reading %s', 'twentyfifteen' ), - the_title( '<span class="screen-reader-text">', '</span>', false ) - ) ); + the_content( + sprintf( + __( 'Continue reading %s', 'twentyfifteen' ), + the_title( '<span class="screen-reader-text">', '</span>', false ) + ) + ); - wp_link_pages( array( - 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfifteen' ) . '</span>', - 'after' => '</div>', - 'link_before' => '<span>', - 'link_after' => '</span>', - 'pagelink' => '<span class="screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>%', - 'separator' => '<span class="screen-reader-text">, </span>', - ) ); - ?> + wp_link_pages( + array( + 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfifteen' ) . '</span>', + 'after' => '</div>', + 'link_before' => '<span>', + 'link_after' => '</span>', + 'pagelink' => '<span class="screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>%', + 'separator' => '<span class="screen-reader-text">, </span>', + ) + ); + ?> </div><!-- .entry-content --> <?php // Author bio. - if ( is_single() && get_the_author_meta( 'description' ) ) : - get_template_part( 'author-bio' ); + if ( is_single() && get_the_author_meta( 'description' ) ) : + get_template_part( 'author-bio' ); endif; ?> diff --git a/themes/twentyfifteen/css/blocks.css b/themes/twentyfifteen/css/blocks.css index 82563902..fa9d935a 100644 --- a/themes/twentyfifteen/css/blocks.css +++ b/themes/twentyfifteen/css/blocks.css @@ -384,8 +384,6 @@ p.has-drop-cap:not(:focus)::first-letter { /* Button */ .wp-block-button .wp-block-button__link { - border: 0; - border-radius: 0; cursor: pointer; font-family: "Noto Sans", sans-serif; font-size: 12px; @@ -397,13 +395,27 @@ p.has-drop-cap:not(:focus)::first-letter { vertical-align: baseline; } +.entry-content .wp-block-button:not(.is-style-outline) .wp-block-button__link { + border: 0; +} + +.entry-content .wp-block-button.is-style-outline .wp-block-button__link:hover { + border-bottom: 2px solid; +} + .wp-block-button__link { background-color: #333; color: #fff; } +.is-style-outline .wp-block-button__link:not(.has-text-color) { + color: #333; +} + .wp-block-button__link:hover, -.wp-block-button__link:focus { +.wp-block-button__link:focus, +.is-style-outline .wp-block-button__link:hover, +.is-style-outline .wp-block-button__link:focus { background-color: #707070; background-color: rgba(51, 51, 51, 0.7); color: #fff; diff --git a/themes/twentyfifteen/css/editor-blocks.css b/themes/twentyfifteen/css/editor-blocks.css index 6076cab6..5b1e90c9 100644 --- a/themes/twentyfifteen/css/editor-blocks.css +++ b/themes/twentyfifteen/css/editor-blocks.css @@ -708,10 +708,6 @@ p.has-drop-cap:not(:focus)::first-letter { /* Button */ .wp-block-button .wp-block-button__link { - background-color: #333; - border: 0; - border-radius: 0; - color: #fff; cursor: pointer; font-family: "Noto Sans", sans-serif; font-size: 12px; @@ -722,6 +718,15 @@ p.has-drop-cap:not(:focus)::first-letter { vertical-align: baseline; } +.wp-block-button__link { + background-color: #333; + color: #fff; +} + +.is-style-outline .wp-block-button__link { + color: #333; +} + @media screen and (min-width: 46.25em) { .wp-block-button .wp-block-button__link { font-size: 14px; diff --git a/themes/twentyfifteen/functions.php b/themes/twentyfifteen/functions.php index 168bedd9..2713ba2c 100644 --- a/themes/twentyfifteen/functions.php +++ b/themes/twentyfifteen/functions.php @@ -42,182 +42,214 @@ if ( version_compare( $GLOBALS['wp_version'], '4.1-alpha', '<' ) ) { } if ( ! function_exists( 'twentyfifteen_setup' ) ) : -/** - * Sets up theme defaults and registers support for various WordPress features. - * - * Note that this function is hooked into the after_setup_theme hook, which - * runs before the init hook. The init hook is too late for some features, such - * as indicating support for post thumbnails. - * - * @since Twenty Fifteen 1.0 - */ -function twentyfifteen_setup() { - - /* - * Make theme available for translation. - * Translations can be filed at WordPress.org. See: https://translate.wordpress.org/projects/wp-themes/twentyfifteen - * If you're building a theme based on twentyfifteen, use a find and replace - * to change 'twentyfifteen' to the name of your theme in all the template files - */ - load_theme_textdomain( 'twentyfifteen' ); - - // Add default posts and comments RSS feed links to head. - add_theme_support( 'automatic-feed-links' ); - - /* - * Let WordPress manage the document title. - * By adding theme support, we declare that this theme does not use a - * hard-coded <title> tag in the document head, and expect WordPress to - * provide it for us. - */ - add_theme_support( 'title-tag' ); - - /* - * Enable support for Post Thumbnails on posts and pages. - * - * See: https://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails - */ - add_theme_support( 'post-thumbnails' ); - set_post_thumbnail_size( 825, 510, true ); - - // This theme uses wp_nav_menu() in two locations. - register_nav_menus( array( - 'primary' => __( 'Primary Menu', 'twentyfifteen' ), - 'social' => __( 'Social Links Menu', 'twentyfifteen' ), - ) ); - - /* - * Switch default core markup for search form, comment form, and comments - * to output valid HTML5. - */ - add_theme_support( 'html5', array( - 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' - ) ); - - /* - * Enable support for Post Formats. - * - * See: https://codex.wordpress.org/Post_Formats - */ - add_theme_support( 'post-formats', array( - 'aside', 'image', 'video', 'quote', 'link', 'gallery', 'status', 'audio', 'chat' - ) ); - - /* - * Enable support for custom logo. - * - * @since Twenty Fifteen 1.5 - */ - add_theme_support( 'custom-logo', array( - 'height' => 248, - 'width' => 248, - 'flex-height' => true, - ) ); - - $color_scheme = twentyfifteen_get_color_scheme(); - $default_color = trim( $color_scheme[0], '#' ); - - // Setup the WordPress core custom background feature. - /** - * Filter Twenty Fifteen custom-header support arguments. + * Sets up theme defaults and registers support for various WordPress features. * - * @since Twenty Fifteen 1.0 - * - * @param array $args { - * An array of custom-header support arguments. + * Note that this function is hooked into the after_setup_theme hook, which + * runs before the init hook. The init hook is too late for some features, such + * as indicating support for post thumbnails. * - * @type string $default-color Default color of the header. - * @type string $default-attachment Default attachment of the header. - * } - */ - add_theme_support( 'custom-background', apply_filters( 'twentyfifteen_custom_background_args', array( - 'default-color' => $default_color, - 'default-attachment' => 'fixed', - ) ) ); - - /* - * This theme styles the visual editor to resemble the theme style, - * specifically font, colors, icons, and column width. + * @since Twenty Fifteen 1.0 */ - add_editor_style( array( 'css/editor-style.css', 'genericons/genericons.css', twentyfifteen_fonts_url() ) ); - - // Load regular editor styles into the new block-based editor. - add_theme_support( 'editor-styles' ); - - // Load default block styles. - add_theme_support( 'wp-block-styles' ); - - // Add support for responsive embeds. - add_theme_support( 'responsive-embeds' ); - - // Add support for custom color scheme. - add_theme_support( 'editor-color-palette', array( - array( - 'name' => __( 'Dark Gray', 'twentyfifteen' ), - 'slug' => 'dark-gray', - 'color' => '#111', - ), - array( - 'name' => __( 'Light Gray', 'twentyfifteen' ), - 'slug' => 'light-gray', - 'color' => '#f1f1f1', - ), - array( - 'name' => __( 'White', 'twentyfifteen' ), - 'slug' => 'white', - 'color' => '#fff', - ), - array( - 'name' => __( 'Yellow', 'twentyfifteen' ), - 'slug' => 'yellow', - 'color' => '#f4ca16', - ), - array( - 'name' => __( 'Dark Brown', 'twentyfifteen' ), - 'slug' => 'dark-brown', - 'color' => '#352712', - ), - array( - 'name' => __( 'Medium Pink', 'twentyfifteen' ), - 'slug' => 'medium-pink', - 'color' => '#e53b51', - ), - array( - 'name' => __( 'Light Pink', 'twentyfifteen' ), - 'slug' => 'light-pink', - 'color' => '#ffe5d1', - ), - array( - 'name' => __( 'Dark Purple', 'twentyfifteen' ), - 'slug' => 'dark-purple', - 'color' => '#2e2256', - ), - array( - 'name' => __( 'Purple', 'twentyfifteen' ), - 'slug' => 'purple', - 'color' => '#674970', - ), - array( - 'name' => __( 'Blue Gray', 'twentyfifteen' ), - 'slug' => 'blue-gray', - 'color' => '#22313f', - ), - array( - 'name' => __( 'Bright Blue', 'twentyfifteen' ), - 'slug' => 'bright-blue', - 'color' => '#55c3dc', - ), - array( - 'name' => __( 'Light Blue', 'twentyfifteen' ), - 'slug' => 'light-blue', - 'color' => '#e9f2f9', - ), - ) ); - - // Indicate widget sidebars can use selective refresh in the Customizer. - add_theme_support( 'customize-selective-refresh-widgets' ); -} + function twentyfifteen_setup() { + + /* + * Make theme available for translation. + * Translations can be filed at WordPress.org. See: https://translate.wordpress.org/projects/wp-themes/twentyfifteen + * If you're building a theme based on twentyfifteen, use a find and replace + * to change 'twentyfifteen' to the name of your theme in all the template files + */ + load_theme_textdomain( 'twentyfifteen' ); + + // Add default posts and comments RSS feed links to head. + add_theme_support( 'automatic-feed-links' ); + + /* + * Let WordPress manage the document title. + * By adding theme support, we declare that this theme does not use a + * hard-coded <title> tag in the document head, and expect WordPress to + * provide it for us. + */ + add_theme_support( 'title-tag' ); + + /* + * Enable support for Post Thumbnails on posts and pages. + * + * See: https://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails + */ + add_theme_support( 'post-thumbnails' ); + set_post_thumbnail_size( 825, 510, true ); + + // This theme uses wp_nav_menu() in two locations. + register_nav_menus( + array( + 'primary' => __( 'Primary Menu', 'twentyfifteen' ), + 'social' => __( 'Social Links Menu', 'twentyfifteen' ), + ) + ); + + /* + * Switch default core markup for search form, comment form, and comments + * to output valid HTML5. + */ + add_theme_support( + 'html5', + array( + 'search-form', + 'comment-form', + 'comment-list', + 'gallery', + 'caption', + ) + ); + + /* + * Enable support for Post Formats. + * + * See: https://codex.wordpress.org/Post_Formats + */ + add_theme_support( + 'post-formats', + array( + 'aside', + 'image', + 'video', + 'quote', + 'link', + 'gallery', + 'status', + 'audio', + 'chat', + ) + ); + + /* + * Enable support for custom logo. + * + * @since Twenty Fifteen 1.5 + */ + add_theme_support( + 'custom-logo', + array( + 'height' => 248, + 'width' => 248, + 'flex-height' => true, + ) + ); + + $color_scheme = twentyfifteen_get_color_scheme(); + $default_color = trim( $color_scheme[0], '#' ); + + // Setup the WordPress core custom background feature. + + /** + * Filter Twenty Fifteen custom-header support arguments. + * + * @since Twenty Fifteen 1.0 + * + * @param array $args { + * An array of custom-header support arguments. + * + * @type string $default-color Default color of the header. + * @type string $default-attachment Default attachment of the header. + * } + */ + add_theme_support( + 'custom-background', + apply_filters( + 'twentyfifteen_custom_background_args', + array( + 'default-color' => $default_color, + 'default-attachment' => 'fixed', + ) + ) + ); + + /* + * This theme styles the visual editor to resemble the theme style, + * specifically font, colors, icons, and column width. + */ + add_editor_style( array( 'css/editor-style.css', 'genericons/genericons.css', twentyfifteen_fonts_url() ) ); + + // Load regular editor styles into the new block-based editor. + add_theme_support( 'editor-styles' ); + + // Load default block styles. + add_theme_support( 'wp-block-styles' ); + + // Add support for responsive embeds. + add_theme_support( 'responsive-embeds' ); + + // Add support for custom color scheme. + add_theme_support( + 'editor-color-palette', + array( + array( + 'name' => __( 'Dark Gray', 'twentyfifteen' ), + 'slug' => 'dark-gray', + 'color' => '#111', + ), + array( + 'name' => __( 'Light Gray', 'twentyfifteen' ), + 'slug' => 'light-gray', + 'color' => '#f1f1f1', + ), + array( + 'name' => __( 'White', 'twentyfifteen' ), + 'slug' => 'white', + 'color' => '#fff', + ), + array( + 'name' => __( 'Yellow', 'twentyfifteen' ), + 'slug' => 'yellow', + 'color' => '#f4ca16', + ), + array( + 'name' => __( 'Dark Brown', 'twentyfifteen' ), + 'slug' => 'dark-brown', + 'color' => '#352712', + ), + array( + 'name' => __( 'Medium Pink', 'twentyfifteen' ), + 'slug' => 'medium-pink', + 'color' => '#e53b51', + ), + array( + 'name' => __( 'Light Pink', 'twentyfifteen' ), + 'slug' => 'light-pink', + 'color' => '#ffe5d1', + ), + array( + 'name' => __( 'Dark Purple', 'twentyfifteen' ), + 'slug' => 'dark-purple', + 'color' => '#2e2256', + ), + array( + 'name' => __( 'Purple', 'twentyfifteen' ), + 'slug' => 'purple', + 'color' => '#674970', + ), + array( + 'name' => __( 'Blue Gray', 'twentyfifteen' ), + 'slug' => 'blue-gray', + 'color' => '#22313f', + ), + array( + 'name' => __( 'Bright Blue', 'twentyfifteen' ), + 'slug' => 'bright-blue', + 'color' => '#55c3dc', + ), + array( + 'name' => __( 'Light Blue', 'twentyfifteen' ), + 'slug' => 'light-blue', + 'color' => '#e9f2f9', + ), + ) + ); + + // Indicate widget sidebars can use selective refresh in the Customizer. + add_theme_support( 'customize-selective-refresh-widgets' ); + } endif; // twentyfifteen_setup add_action( 'after_setup_theme', 'twentyfifteen_setup' ); @@ -229,80 +261,85 @@ add_action( 'after_setup_theme', 'twentyfifteen_setup' ); * @link https://codex.wordpress.org/Function_Reference/register_sidebar */ function twentyfifteen_widgets_init() { - register_sidebar( array( - 'name' => __( 'Widget Area', 'twentyfifteen' ), - 'id' => 'sidebar-1', - 'description' => __( 'Add widgets here to appear in your sidebar.', 'twentyfifteen' ), - 'before_widget' => '<aside id="%1$s" class="widget %2$s">', - 'after_widget' => '</aside>', - 'before_title' => '<h2 class="widget-title">', - 'after_title' => '</h2>', - ) ); + register_sidebar( + array( + 'name' => __( 'Widget Area', 'twentyfifteen' ), + 'id' => 'sidebar-1', + 'description' => __( 'Add widgets here to appear in your sidebar.', 'twentyfifteen' ), + 'before_widget' => '<aside id="%1$s" class="widget %2$s">', + 'after_widget' => '</aside>', + 'before_title' => '<h2 class="widget-title">', + 'after_title' => '</h2>', + ) + ); } add_action( 'widgets_init', 'twentyfifteen_widgets_init' ); if ( ! function_exists( 'twentyfifteen_fonts_url' ) ) : -/** - * Register Google fonts for Twenty Fifteen. - * - * @since Twenty Fifteen 1.0 - * - * @return string Google fonts URL for the theme. - */ -function twentyfifteen_fonts_url() { - $fonts_url = ''; - $fonts = array(); - $subsets = 'latin,latin-ext'; - - /* - * Translators: If there are characters in your language that are not supported - * by Noto Sans, translate this to 'off'. Do not translate into your own language. + /** + * Register Google fonts for Twenty Fifteen. + * + * @since Twenty Fifteen 1.0 + * + * @return string Google fonts URL for the theme. */ - if ( 'off' !== _x( 'on', 'Noto Sans font: on or off', 'twentyfifteen' ) ) { - $fonts[] = 'Noto Sans:400italic,700italic,400,700'; - } + function twentyfifteen_fonts_url() { + $fonts_url = ''; + $fonts = array(); + $subsets = 'latin,latin-ext'; + + /* + * Translators: If there are characters in your language that are not supported + * by Noto Sans, translate this to 'off'. Do not translate into your own language. + */ + if ( 'off' !== _x( 'on', 'Noto Sans font: on or off', 'twentyfifteen' ) ) { + $fonts[] = 'Noto Sans:400italic,700italic,400,700'; + } - /* - * Translators: If there are characters in your language that are not supported - * by Noto Serif, translate this to 'off'. Do not translate into your own language. - */ - if ( 'off' !== _x( 'on', 'Noto Serif font: on or off', 'twentyfifteen' ) ) { - $fonts[] = 'Noto Serif:400italic,700italic,400,700'; - } + /* + * Translators: If there are characters in your language that are not supported + * by Noto Serif, translate this to 'off'. Do not translate into your own language. + */ + if ( 'off' !== _x( 'on', 'Noto Serif font: on or off', 'twentyfifteen' ) ) { + $fonts[] = 'Noto Serif:400italic,700italic,400,700'; + } - /* - * Translators: If there are characters in your language that are not supported - * by Inconsolata, translate this to 'off'. Do not translate into your own language. - */ - if ( 'off' !== _x( 'on', 'Inconsolata font: on or off', 'twentyfifteen' ) ) { - $fonts[] = 'Inconsolata:400,700'; - } + /* + * Translators: If there are characters in your language that are not supported + * by Inconsolata, translate this to 'off'. Do not translate into your own language. + */ + if ( 'off' !== _x( 'on', 'Inconsolata font: on or off', 'twentyfifteen' ) ) { + $fonts[] = 'Inconsolata:400,700'; + } - /* - * Translators: To add an additional character subset specific to your language, - * translate this to 'greek', 'cyrillic', 'devanagari' or 'vietnamese'. Do not translate into your own language. - */ - $subset = _x( 'no-subset', 'Add new subset (greek, cyrillic, devanagari, vietnamese)', 'twentyfifteen' ); - - if ( 'cyrillic' == $subset ) { - $subsets .= ',cyrillic,cyrillic-ext'; - } elseif ( 'greek' == $subset ) { - $subsets .= ',greek,greek-ext'; - } elseif ( 'devanagari' == $subset ) { - $subsets .= ',devanagari'; - } elseif ( 'vietnamese' == $subset ) { - $subsets .= ',vietnamese'; - } + /* + * Translators: To add an additional character subset specific to your language, + * translate this to 'greek', 'cyrillic', 'devanagari' or 'vietnamese'. Do not translate into your own language. + */ + $subset = _x( 'no-subset', 'Add new subset (greek, cyrillic, devanagari, vietnamese)', 'twentyfifteen' ); + + if ( 'cyrillic' == $subset ) { + $subsets .= ',cyrillic,cyrillic-ext'; + } elseif ( 'greek' == $subset ) { + $subsets .= ',greek,greek-ext'; + } elseif ( 'devanagari' == $subset ) { + $subsets .= ',devanagari'; + } elseif ( 'vietnamese' == $subset ) { + $subsets .= ',vietnamese'; + } - if ( $fonts ) { - $fonts_url = add_query_arg( array( - 'family' => urlencode( implode( '|', $fonts ) ), - 'subset' => urlencode( $subsets ), - ), 'https://fonts.googleapis.com/css' ); - } + if ( $fonts ) { + $fonts_url = add_query_arg( + array( + 'family' => urlencode( implode( '|', $fonts ) ), + 'subset' => urlencode( $subsets ), + ), + 'https://fonts.googleapis.com/css' + ); + } - return $fonts_url; -} + return $fonts_url; + } endif; /** @@ -333,7 +370,7 @@ function twentyfifteen_scripts() { wp_enqueue_style( 'twentyfifteen-style', get_stylesheet_uri() ); // Theme block stylesheet. - wp_enqueue_style( 'twentyfifteen-block-style', get_template_directory_uri() . '/css/blocks.css', array( 'twentyfifteen-style' ), '20181018' ); + wp_enqueue_style( 'twentyfifteen-block-style', get_template_directory_uri() . '/css/blocks.css', array( 'twentyfifteen-style' ), '20181230' ); // Load the Internet Explorer specific stylesheet. wp_enqueue_style( 'twentyfifteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentyfifteen-style' ), '20141010' ); @@ -354,10 +391,14 @@ function twentyfifteen_scripts() { } wp_enqueue_script( 'twentyfifteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20150330', true ); - wp_localize_script( 'twentyfifteen-script', 'screenReaderText', array( - 'expand' => '<span class="screen-reader-text">' . __( 'expand child menu', 'twentyfifteen' ) . '</span>', - 'collapse' => '<span class="screen-reader-text">' . __( 'collapse child menu', 'twentyfifteen' ) . '</span>', - ) ); + wp_localize_script( + 'twentyfifteen-script', + 'screenReaderText', + array( + 'expand' => '<span class="screen-reader-text">' . __( 'expand child menu', 'twentyfifteen' ) . '</span>', + 'collapse' => '<span class="screen-reader-text">' . __( 'collapse child menu', 'twentyfifteen' ) . '</span>', + ) + ); } add_action( 'wp_enqueue_scripts', 'twentyfifteen_scripts' ); @@ -368,7 +409,7 @@ add_action( 'wp_enqueue_scripts', 'twentyfifteen_scripts' ); */ function twentyfifteen_block_editor_styles() { // Block styles. - wp_enqueue_style( 'twentyfifteen-block-editor-style', get_template_directory_uri() . '/css/editor-blocks.css' ); + wp_enqueue_style( 'twentyfifteen-block-editor-style', get_template_directory_uri() . '/css/editor-blocks.css', array(), '20181230' ); // Add custom fonts. wp_enqueue_style( 'twentyfifteen-fonts', twentyfifteen_fonts_url(), array(), null ); } @@ -420,9 +461,9 @@ function twentyfifteen_post_nav_background() { return; } - if ( $previous && has_post_thumbnail( $previous->ID ) ) { + if ( $previous && has_post_thumbnail( $previous->ID ) ) { $prevthumb = wp_get_attachment_image_src( get_post_thumbnail_id( $previous->ID ), 'post-thumbnail' ); - $css .= ' + $css .= ' .post-navigation .nav-previous { background-image: url(' . esc_url( $prevthumb[0] ) . '); } .post-navigation .nav-previous .post-title, .post-navigation .nav-previous a:hover .post-title, .post-navigation .nav-previous .meta-nav { color: #fff; } .post-navigation .nav-previous a:before { background-color: rgba(0, 0, 0, 0.4); } @@ -431,7 +472,7 @@ function twentyfifteen_post_nav_background() { if ( $next && has_post_thumbnail( $next->ID ) ) { $nextthumb = wp_get_attachment_image_src( get_post_thumbnail_id( $next->ID ), 'post-thumbnail' ); - $css .= ' + $css .= ' .post-navigation .nav-next { background-image: url(' . esc_url( $nextthumb[0] ) . '); border-top: 0; } .post-navigation .nav-next .post-title, .post-navigation .nav-next a:hover .post-title, .post-navigation .nav-next .meta-nav { color: #fff; } .post-navigation .nav-next a:before { background-color: rgba(0, 0, 0, 0.4); } diff --git a/themes/twentyfifteen/header.php b/themes/twentyfifteen/header.php index 28de34ed..63b04377 100644 --- a/themes/twentyfifteen/header.php +++ b/themes/twentyfifteen/header.php @@ -14,7 +14,7 @@ <meta charset="<?php bloginfo( 'charset' ); ?>"> <meta name="viewport" content="width=device-width"> <link rel="profile" href="http://gmpg.org/xfn/11"> - <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>"> + <link rel="pingback" href="<?php echo esc_url( get_bloginfo( 'pingback_url' ) ); ?>"> <!--[if lt IE 9]> <script src="<?php echo esc_url( get_template_directory_uri() ); ?>/js/html5.js"></script> <![endif]--> @@ -31,17 +31,21 @@ <?php twentyfifteen_the_custom_logo(); - if ( is_front_page() && is_home() ) : ?> + if ( is_front_page() && is_home() ) : + ?> <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1> <?php else : ?> <p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p> - <?php endif; + <?php + endif; $description = get_bloginfo( 'description', 'display' ); - if ( $description || is_customize_preview() ) : ?> + if ( $description || is_customize_preview() ) : + ?> <p class="site-description"><?php echo $description; ?></p> - <?php endif; - ?> + <?php + endif; + ?> <button class="secondary-toggle"><?php _e( 'Menu and widgets', 'twentyfifteen' ); ?></button> </div><!-- .site-branding --> </header><!-- .site-header --> diff --git a/themes/twentyfifteen/image.php b/themes/twentyfifteen/image.php index 5a471d40..5afa773f 100644 --- a/themes/twentyfifteen/image.php +++ b/themes/twentyfifteen/image.php @@ -14,38 +14,39 @@ get_header(); ?> <?php // Start the loop. - while ( have_posts() ) : the_post(); - ?> - - <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> + while ( have_posts() ) : + the_post(); + ?> - <nav id="image-navigation" class="navigation image-navigation"> - <div class="nav-links"> - <div class="nav-previous"><?php previous_image_link( false, __( 'Previous Image', 'twentyfifteen' ) ); ?></div><div class="nav-next"><?php next_image_link( false, __( 'Next Image', 'twentyfifteen' ) ); ?></div> - </div><!-- .nav-links --> - </nav><!-- .image-navigation --> + <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> - <header class="entry-header"> - <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?> - </header><!-- .entry-header --> + <nav id="image-navigation" class="navigation image-navigation"> + <div class="nav-links"> + <div class="nav-previous"><?php previous_image_link( false, __( 'Previous Image', 'twentyfifteen' ) ); ?></div><div class="nav-next"><?php next_image_link( false, __( 'Next Image', 'twentyfifteen' ) ); ?></div> + </div><!-- .nav-links --> + </nav><!-- .image-navigation --> - <div class="entry-content"> + <header class="entry-header"> + <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?> + </header><!-- .entry-header --> - <div class="entry-attachment"> - <?php - /** - * Filter the default Twenty Fifteen image attachment size. - * - * @since Twenty Fifteen 1.0 - * - * @param string $image_size Image size. Default 'large'. - */ - $image_size = apply_filters( 'twentyfifteen_attachment_size', 'large' ); + <div class="entry-content"> - echo wp_get_attachment_image( get_the_ID(), $image_size ); - ?> + <div class="entry-attachment"> + <?php + /** + * Filter the default Twenty Fifteen image attachment size. + * + * @since Twenty Fifteen 1.0 + * + * @param string $image_size Image size. Default 'large'. + */ + $image_size = apply_filters( 'twentyfifteen_attachment_size', 'large' ); + + echo wp_get_attachment_image( get_the_ID(), $image_size ); + ?> - <?php if ( has_excerpt() ) : ?> + <?php if ( has_excerpt() ) : ?> <div class="entry-caption"> <?php the_excerpt(); ?> </div><!-- .entry-caption --> @@ -54,35 +55,39 @@ get_header(); ?> </div><!-- .entry-attachment --> <?php - the_content(); - wp_link_pages( array( + the_content(); + wp_link_pages( + array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfifteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>', 'pagelink' => '<span class="screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>%', 'separator' => '<span class="screen-reader-text">, </span>', - ) ); + ) + ); ?> </div><!-- .entry-content --> <footer class="entry-footer"> - <?php twentyfifteen_entry_meta(); ?> + <?php twentyfifteen_entry_meta(); ?> <?php edit_post_link( __( 'Edit', 'twentyfifteen' ), '<span class="edit-link">', '</span>' ); ?> </footer><!-- .entry-footer --> </article><!-- #post-## --> <?php - // If comments are open or we have at least one comment, load up the comment template - if ( comments_open() || get_comments_number() ) : - comments_template(); + // If comments are open or we have at least one comment, load up the comment template + if ( comments_open() || get_comments_number() ) : + comments_template(); endif; - // Previous/next post navigation. - the_post_navigation( array( + // Previous/next post navigation. + the_post_navigation( + array( 'prev_text' => _x( '<span class="meta-nav">Published in</span><span class="post-title">%title</span>', 'Parent post link', 'twentyfifteen' ), - ) ); + ) + ); // End the loop. endwhile; diff --git a/themes/twentyfifteen/inc/back-compat.php b/themes/twentyfifteen/inc/back-compat.php index 73cd44d1..a4f03e3a 100644 --- a/themes/twentyfifteen/inc/back-compat.php +++ b/themes/twentyfifteen/inc/back-compat.php @@ -44,9 +44,13 @@ function twentyfifteen_upgrade_notice() { * @since Twenty Fifteen 1.0 */ function twentyfifteen_customize() { - wp_die( sprintf( __( 'Twenty Fifteen requires at least WordPress version 4.1. You are running version %s. Please upgrade and try again.', 'twentyfifteen' ), $GLOBALS['wp_version'] ), '', array( - 'back_link' => true, - ) ); + wp_die( + sprintf( __( 'Twenty Fifteen requires at least WordPress version 4.1. You are running version %s. Please upgrade and try again.', 'twentyfifteen' ), $GLOBALS['wp_version'] ), + '', + array( + 'back_link' => true, + ) + ); } add_action( 'load-customize.php', 'twentyfifteen_customize' ); diff --git a/themes/twentyfifteen/inc/custom-header.php b/themes/twentyfifteen/inc/custom-header.php index 10d0ef1a..763ef00d 100644 --- a/themes/twentyfifteen/inc/custom-header.php +++ b/themes/twentyfifteen/inc/custom-header.php @@ -13,8 +13,8 @@ * @uses twentyfifteen_header_style() */ function twentyfifteen_custom_header_setup() { - $color_scheme = twentyfifteen_get_color_scheme(); - $default_text_color = trim( $color_scheme[4], '#' ); + $color_scheme = twentyfifteen_get_color_scheme(); + $default_text_color = trim( $color_scheme[4], '#' ); /** * Filter Twenty Fifteen custom-header support arguments. @@ -31,12 +31,18 @@ function twentyfifteen_custom_header_setup() { * displayed on the blog. * } */ - add_theme_support( 'custom-header', apply_filters( 'twentyfifteen_custom_header_args', array( - 'default-text-color' => $default_text_color, - 'width' => 954, - 'height' => 1300, - 'wp-head-callback' => 'twentyfifteen_header_style', - ) ) ); + add_theme_support( + 'custom-header', + apply_filters( + 'twentyfifteen_custom_header_args', + array( + 'default-text-color' => $default_text_color, + 'width' => 954, + 'height' => 1300, + 'wp-head-callback' => 'twentyfifteen_header_style', + ) + ) + ); } add_action( 'after_setup_theme', 'twentyfifteen_custom_header_setup' ); @@ -53,10 +59,10 @@ function twentyfifteen_hex2rgb( $color ) { $color = trim( $color, '#' ); if ( strlen( $color ) == 3 ) { - $r = hexdec( substr( $color, 0, 1 ).substr( $color, 0, 1 ) ); - $g = hexdec( substr( $color, 1, 1 ).substr( $color, 1, 1 ) ); - $b = hexdec( substr( $color, 2, 1 ).substr( $color, 2, 1 ) ); - } else if ( strlen( $color ) == 6 ) { + $r = hexdec( substr( $color, 0, 1 ) . substr( $color, 0, 1 ) ); + $g = hexdec( substr( $color, 1, 1 ) . substr( $color, 1, 1 ) ); + $b = hexdec( substr( $color, 2, 1 ) . substr( $color, 2, 1 ) ); + } elseif ( strlen( $color ) == 6 ) { $r = hexdec( substr( $color, 0, 2 ) ); $g = hexdec( substr( $color, 2, 2 ) ); $b = hexdec( substr( $color, 4, 2 ) ); @@ -64,32 +70,36 @@ function twentyfifteen_hex2rgb( $color ) { return array(); } - return array( 'red' => $r, 'green' => $g, 'blue' => $b ); + return array( + 'red' => $r, + 'green' => $g, + 'blue' => $b, + ); } if ( ! function_exists( 'twentyfifteen_header_style' ) ) : -/** - * Styles the header image and text displayed on the blog. - * - * @since Twenty Fifteen 1.0 - * - * @see twentyfifteen_custom_header_setup() - */ -function twentyfifteen_header_style() { - $header_image = get_header_image(); + /** + * Styles the header image and text displayed on the blog. + * + * @since Twenty Fifteen 1.0 + * + * @see twentyfifteen_custom_header_setup() + */ + function twentyfifteen_header_style() { + $header_image = get_header_image(); - // If no custom options for text are set, let's bail. - if ( empty( $header_image ) && display_header_text() ) { - return; - } + // If no custom options for text are set, let's bail. + if ( empty( $header_image ) && display_header_text() ) { + return; + } - // If we get this far, we have custom styles. Let's do this. - ?> - <style type="text/css" id="twentyfifteen-header-css"> - <?php + // If we get this far, we have custom styles. Let's do this. + ?> + <style type="text/css" id="twentyfifteen-header-css"> + <?php // Short header for when there is no Custom Header and Header Text is hidden. if ( empty( $header_image ) && ! display_header_text() ) : - ?> + ?> .site-header { padding-top: 14px; padding-bottom: 14px; @@ -126,12 +136,12 @@ function twentyfifteen_header_style() { min-height: 0; } } - <?php + <?php endif; // Has a Custom Header been added? if ( ! empty( $header_image ) ) : - ?> + ?> .site-header { /* @@ -168,12 +178,12 @@ function twentyfifteen_header_style() { background: transparent; } } - <?php + <?php endif; // Has the text been hidden? if ( ! display_header_text() ) : - ?> + ?> .site-title, .site-description { clip: rect(1px, 1px, 1px, 1px); @@ -181,8 +191,8 @@ function twentyfifteen_header_style() { } <?php endif; ?> </style> - <?php -} + <?php + } endif; // twentyfifteen_header_style /** diff --git a/themes/twentyfifteen/inc/customizer.php b/themes/twentyfifteen/inc/customizer.php index c31c57e8..3b74f243 100644 --- a/themes/twentyfifteen/inc/customizer.php +++ b/themes/twentyfifteen/inc/customizer.php @@ -21,61 +21,91 @@ function twentyfifteen_customize_register( $wp_customize ) { $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; if ( isset( $wp_customize->selective_refresh ) ) { - $wp_customize->selective_refresh->add_partial( 'blogname', array( - 'selector' => '.site-title a', - 'container_inclusive' => false, - 'render_callback' => 'twentyfifteen_customize_partial_blogname', - ) ); - $wp_customize->selective_refresh->add_partial( 'blogdescription', array( - 'selector' => '.site-description', - 'container_inclusive' => false, - 'render_callback' => 'twentyfifteen_customize_partial_blogdescription', - ) ); + $wp_customize->selective_refresh->add_partial( + 'blogname', + array( + 'selector' => '.site-title a', + 'container_inclusive' => false, + 'render_callback' => 'twentyfifteen_customize_partial_blogname', + ) + ); + $wp_customize->selective_refresh->add_partial( + 'blogdescription', + array( + 'selector' => '.site-description', + 'container_inclusive' => false, + 'render_callback' => 'twentyfifteen_customize_partial_blogdescription', + ) + ); } // Add color scheme setting and control. - $wp_customize->add_setting( 'color_scheme', array( - 'default' => 'default', - 'sanitize_callback' => 'twentyfifteen_sanitize_color_scheme', - 'transport' => 'postMessage', - ) ); - - $wp_customize->add_control( 'color_scheme', array( - 'label' => __( 'Base Color Scheme', 'twentyfifteen' ), - 'section' => 'colors', - 'type' => 'select', - 'choices' => twentyfifteen_get_color_scheme_choices(), - 'priority' => 1, - ) ); + $wp_customize->add_setting( + 'color_scheme', + array( + 'default' => 'default', + 'sanitize_callback' => 'twentyfifteen_sanitize_color_scheme', + 'transport' => 'postMessage', + ) + ); + + $wp_customize->add_control( + 'color_scheme', + array( + 'label' => __( 'Base Color Scheme', 'twentyfifteen' ), + 'section' => 'colors', + 'type' => 'select', + 'choices' => twentyfifteen_get_color_scheme_choices(), + 'priority' => 1, + ) + ); // Add custom header and sidebar text color setting and control. - $wp_customize->add_setting( 'sidebar_textcolor', array( - 'default' => $color_scheme[4], - 'sanitize_callback' => 'sanitize_hex_color', - 'transport' => 'postMessage', - ) ); - - $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'sidebar_textcolor', array( - 'label' => __( 'Header and Sidebar Text Color', 'twentyfifteen' ), - 'description' => __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ), - 'section' => 'colors', - ) ) ); + $wp_customize->add_setting( + 'sidebar_textcolor', + array( + 'default' => $color_scheme[4], + 'sanitize_callback' => 'sanitize_hex_color', + 'transport' => 'postMessage', + ) + ); + + $wp_customize->add_control( + new WP_Customize_Color_Control( + $wp_customize, + 'sidebar_textcolor', + array( + 'label' => __( 'Header and Sidebar Text Color', 'twentyfifteen' ), + 'description' => __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ), + 'section' => 'colors', + ) + ) + ); // Remove the core header textcolor control, as it shares the sidebar text color. $wp_customize->remove_control( 'header_textcolor' ); // Add custom header and sidebar background color setting and control. - $wp_customize->add_setting( 'header_background_color', array( - 'default' => $color_scheme[1], - 'sanitize_callback' => 'sanitize_hex_color', - 'transport' => 'postMessage', - ) ); - - $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'header_background_color', array( - 'label' => __( 'Header and Sidebar Background Color', 'twentyfifteen' ), - 'description' => __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ), - 'section' => 'colors', - ) ) ); + $wp_customize->add_setting( + 'header_background_color', + array( + 'default' => $color_scheme[1], + 'sanitize_callback' => 'sanitize_hex_color', + 'transport' => 'postMessage', + ) + ); + + $wp_customize->add_control( + new WP_Customize_Color_Control( + $wp_customize, + 'header_background_color', + array( + 'label' => __( 'Header and Sidebar Background Color', 'twentyfifteen' ), + 'description' => __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ), + 'section' => 'colors', + ) + ) + ); // Add an additional description to the header image section. $wp_customize->get_section( 'header_image' )->description = __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ); @@ -145,134 +175,137 @@ function twentyfifteen_get_color_schemes() { * } * } */ - return apply_filters( 'twentyfifteen_color_schemes', array( - 'default' => array( - 'label' => __( 'Default', 'twentyfifteen' ), - 'colors' => array( - '#f1f1f1', - '#ffffff', - '#ffffff', - '#333333', - '#333333', - '#f7f7f7', + return apply_filters( + 'twentyfifteen_color_schemes', + array( + 'default' => array( + 'label' => __( 'Default', 'twentyfifteen' ), + 'colors' => array( + '#f1f1f1', + '#ffffff', + '#ffffff', + '#333333', + '#333333', + '#f7f7f7', + ), ), - ), - 'dark' => array( - 'label' => __( 'Dark', 'twentyfifteen' ), - 'colors' => array( - '#111111', - '#202020', - '#202020', - '#bebebe', - '#bebebe', - '#1b1b1b', + 'dark' => array( + 'label' => __( 'Dark', 'twentyfifteen' ), + 'colors' => array( + '#111111', + '#202020', + '#202020', + '#bebebe', + '#bebebe', + '#1b1b1b', + ), ), - ), - 'yellow' => array( - 'label' => __( 'Yellow', 'twentyfifteen' ), - 'colors' => array( - '#f4ca16', - '#ffdf00', - '#ffffff', - '#111111', - '#111111', - '#f1f1f1', + 'yellow' => array( + 'label' => __( 'Yellow', 'twentyfifteen' ), + 'colors' => array( + '#f4ca16', + '#ffdf00', + '#ffffff', + '#111111', + '#111111', + '#f1f1f1', + ), ), - ), - 'pink' => array( - 'label' => __( 'Pink', 'twentyfifteen' ), - 'colors' => array( - '#ffe5d1', - '#e53b51', - '#ffffff', - '#352712', - '#ffffff', - '#f1f1f1', + 'pink' => array( + 'label' => __( 'Pink', 'twentyfifteen' ), + 'colors' => array( + '#ffe5d1', + '#e53b51', + '#ffffff', + '#352712', + '#ffffff', + '#f1f1f1', + ), ), - ), - 'purple' => array( - 'label' => __( 'Purple', 'twentyfifteen' ), - 'colors' => array( - '#674970', - '#2e2256', - '#ffffff', - '#2e2256', - '#ffffff', - '#f1f1f1', + 'purple' => array( + 'label' => __( 'Purple', 'twentyfifteen' ), + 'colors' => array( + '#674970', + '#2e2256', + '#ffffff', + '#2e2256', + '#ffffff', + '#f1f1f1', + ), ), - ), - 'blue' => array( - 'label' => __( 'Blue', 'twentyfifteen' ), - 'colors' => array( - '#e9f2f9', - '#55c3dc', - '#ffffff', - '#22313f', - '#ffffff', - '#f1f1f1', + 'blue' => array( + 'label' => __( 'Blue', 'twentyfifteen' ), + 'colors' => array( + '#e9f2f9', + '#55c3dc', + '#ffffff', + '#22313f', + '#ffffff', + '#f1f1f1', + ), ), - ), - ) ); + ) + ); } if ( ! function_exists( 'twentyfifteen_get_color_scheme' ) ) : -/** - * Get the current Twenty Fifteen color scheme. - * - * @since Twenty Fifteen 1.0 - * - * @return array An associative array of either the current or default color scheme hex values. - */ -function twentyfifteen_get_color_scheme() { - $color_scheme_option = get_theme_mod( 'color_scheme', 'default' ); - $color_schemes = twentyfifteen_get_color_schemes(); + /** + * Get the current Twenty Fifteen color scheme. + * + * @since Twenty Fifteen 1.0 + * + * @return array An associative array of either the current or default color scheme hex values. + */ + function twentyfifteen_get_color_scheme() { + $color_scheme_option = get_theme_mod( 'color_scheme', 'default' ); + $color_schemes = twentyfifteen_get_color_schemes(); - if ( array_key_exists( $color_scheme_option, $color_schemes ) ) { - return $color_schemes[ $color_scheme_option ]['colors']; - } + if ( array_key_exists( $color_scheme_option, $color_schemes ) ) { + return $color_schemes[ $color_scheme_option ]['colors']; + } - return $color_schemes['default']['colors']; -} + return $color_schemes['default']['colors']; + } endif; // twentyfifteen_get_color_scheme if ( ! function_exists( 'twentyfifteen_get_color_scheme_choices' ) ) : -/** - * Returns an array of color scheme choices registered for Twenty Fifteen. - * - * @since Twenty Fifteen 1.0 - * - * @return array Array of color schemes. - */ -function twentyfifteen_get_color_scheme_choices() { - $color_schemes = twentyfifteen_get_color_schemes(); - $color_scheme_control_options = array(); + /** + * Returns an array of color scheme choices registered for Twenty Fifteen. + * + * @since Twenty Fifteen 1.0 + * + * @return array Array of color schemes. + */ + function twentyfifteen_get_color_scheme_choices() { + $color_schemes = twentyfifteen_get_color_schemes(); + $color_scheme_control_options = array(); - foreach ( $color_schemes as $color_scheme => $value ) { - $color_scheme_control_options[ $color_scheme ] = $value['label']; - } + foreach ( $color_schemes as $color_scheme => $value ) { + $color_scheme_control_options[ $color_scheme ] = $value['label']; + } - return $color_scheme_control_options; -} + return $color_scheme_control_options; + } endif; // twentyfifteen_get_color_scheme_choices if ( ! function_exists( 'twentyfifteen_sanitize_color_scheme' ) ) : -/** - * Sanitization callback for color schemes. - * - * @since Twenty Fifteen 1.0 - * - * @param string $value Color scheme name value. - * @return string Color scheme name. - */ -function twentyfifteen_sanitize_color_scheme( $value ) { - $color_schemes = twentyfifteen_get_color_scheme_choices(); + /** + * Sanitization callback for color schemes. + * + * @since Twenty Fifteen 1.0 + * + * @param string $value Color scheme name value. + * @return string Color scheme name. + */ + function twentyfifteen_sanitize_color_scheme( $value ) { + $color_schemes = twentyfifteen_get_color_scheme_choices(); - if ( ! array_key_exists( $value, $color_schemes ) ) { - $value = 'default'; - } + if ( ! array_key_exists( $value, $color_schemes ) ) { + $value = 'default'; + } - return $value; -} + return $value; + } endif; // twentyfifteen_sanitize_color_scheme /** @@ -295,7 +328,7 @@ function twentyfifteen_color_scheme_css() { // Convert main and sidebar text hex color to rgba. $color_textcolor_rgb = twentyfifteen_hex2rgb( $color_scheme[3] ); $color_sidebar_textcolor_rgb = twentyfifteen_hex2rgb( $color_scheme[4] ); - $colors = array( + $colors = array( 'background_color' => $color_scheme[0], 'header_background_color' => $color_scheme[1], 'box_background_color' => $color_scheme[2], @@ -348,20 +381,23 @@ add_action( 'customize_preview_init', 'twentyfifteen_customize_preview_js' ); * @return string Color scheme CSS. */ function twentyfifteen_get_color_scheme_css( $colors ) { - $colors = wp_parse_args( $colors, array( - 'background_color' => '', - 'header_background_color' => '', - 'box_background_color' => '', - 'textcolor' => '', - 'secondary_textcolor' => '', - 'border_color' => '', - 'border_focus_color' => '', - 'sidebar_textcolor' => '', - 'sidebar_border_color' => '', - 'sidebar_border_focus_color' => '', - 'secondary_sidebar_textcolor' => '', - 'meta_box_background_color' => '', - ) ); + $colors = wp_parse_args( + $colors, + array( + 'background_color' => '', + 'header_background_color' => '', + 'box_background_color' => '', + 'textcolor' => '', + 'secondary_textcolor' => '', + 'border_color' => '', + 'border_focus_color' => '', + 'sidebar_textcolor' => '', + 'sidebar_border_color' => '', + 'sidebar_border_focus_color' => '', + 'secondary_sidebar_textcolor' => '', + 'meta_box_background_color' => '', + ) + ); $css = <<<CSS /* Color Scheme */ diff --git a/themes/twentyfifteen/inc/template-tags.php b/themes/twentyfifteen/inc/template-tags.php index 7b4ffeb7..056d1941 100644 --- a/themes/twentyfifteen/inc/template-tags.php +++ b/themes/twentyfifteen/inc/template-tags.php @@ -10,120 +10,127 @@ */ if ( ! function_exists( 'twentyfifteen_comment_nav' ) ) : -/** - * Display navigation to next/previous comments when applicable. - * - * @since Twenty Fifteen 1.0 - */ -function twentyfifteen_comment_nav() { - // Are there comments to navigate through? - if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : - ?> - <nav class="navigation comment-navigation" role="navigation"> + /** + * Display navigation to next/previous comments when applicable. + * + * @since Twenty Fifteen 1.0 + */ + function twentyfifteen_comment_nav() { + // Are there comments to navigate through? + if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : + ?> + <nav class="navigation comment-navigation" role="navigation"> <h2 class="screen-reader-text"><?php _e( 'Comment navigation', 'twentyfifteen' ); ?></h2> <div class="nav-links"> <?php - if ( $prev_link = get_previous_comments_link( __( 'Older Comments', 'twentyfifteen' ) ) ) : - printf( '<div class="nav-previous">%s</div>', $prev_link ); + if ( $prev_link = get_previous_comments_link( __( 'Older Comments', 'twentyfifteen' ) ) ) : + printf( '<div class="nav-previous">%s</div>', $prev_link ); endif; - if ( $next_link = get_next_comments_link( __( 'Newer Comments', 'twentyfifteen' ) ) ) : - printf( '<div class="nav-next">%s</div>', $next_link ); + if ( $next_link = get_next_comments_link( __( 'Newer Comments', 'twentyfifteen' ) ) ) : + printf( '<div class="nav-next">%s</div>', $next_link ); endif; ?> - </div><!-- .nav-links --> - </nav><!-- .comment-navigation --> - <?php - endif; -} + </div><!-- .nav-links --> + </nav><!-- .comment-navigation --> + <?php + endif; + } endif; if ( ! function_exists( 'twentyfifteen_entry_meta' ) ) : -/** - * Prints HTML with meta information for the categories, tags. - * - * @since Twenty Fifteen 1.0 - */ -function twentyfifteen_entry_meta() { - if ( is_sticky() && is_home() && ! is_paged() ) { - printf( '<span class="sticky-post">%s</span>', __( 'Featured', 'twentyfifteen' ) ); - } - - $format = get_post_format(); - if ( current_theme_supports( 'post-formats', $format ) ) { - printf( '<span class="entry-format">%1$s<a href="%2$s">%3$s</a></span>', - sprintf( '<span class="screen-reader-text">%s </span>', _x( 'Format', 'Used before post format.', 'twentyfifteen' ) ), - esc_url( get_post_format_link( $format ) ), - get_post_format_string( $format ) - ); - } - - if ( in_array( get_post_type(), array( 'post', 'attachment' ) ) ) { - $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>'; + /** + * Prints HTML with meta information for the categories, tags. + * + * @since Twenty Fifteen 1.0 + */ + function twentyfifteen_entry_meta() { + if ( is_sticky() && is_home() && ! is_paged() ) { + printf( '<span class="sticky-post">%s</span>', __( 'Featured', 'twentyfifteen' ) ); + } - if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { - $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>'; + $format = get_post_format(); + if ( current_theme_supports( 'post-formats', $format ) ) { + printf( + '<span class="entry-format">%1$s<a href="%2$s">%3$s</a></span>', + sprintf( '<span class="screen-reader-text">%s </span>', _x( 'Format', 'Used before post format.', 'twentyfifteen' ) ), + esc_url( get_post_format_link( $format ) ), + get_post_format_string( $format ) + ); } - $time_string = sprintf( $time_string, - esc_attr( get_the_date( 'c' ) ), - get_the_date(), - esc_attr( get_the_modified_date( 'c' ) ), - get_the_modified_date() - ); + if ( in_array( get_post_type(), array( 'post', 'attachment' ) ) ) { + $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>'; - printf( '<span class="posted-on"><span class="screen-reader-text">%1$s </span><a href="%2$s" rel="bookmark">%3$s</a></span>', - _x( 'Posted on', 'Used before publish date.', 'twentyfifteen' ), - esc_url( get_permalink() ), - $time_string - ); - } + if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { + $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>'; + } - if ( 'post' == get_post_type() ) { - if ( is_singular() || is_multi_author() ) { - printf( '<span class="byline"><span class="author vcard"><span class="screen-reader-text">%1$s </span><a class="url fn n" href="%2$s">%3$s</a></span></span>', - _x( 'Author', 'Used before post author name.', 'twentyfifteen' ), - esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), - get_the_author() + $time_string = sprintf( + $time_string, + esc_attr( get_the_date( 'c' ) ), + get_the_date(), + esc_attr( get_the_modified_date( 'c' ) ), + get_the_modified_date() ); - } - $categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen' ) ); - if ( $categories_list && twentyfifteen_categorized_blog() ) { - printf( '<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', - _x( 'Categories', 'Used before category names.', 'twentyfifteen' ), - $categories_list + printf( + '<span class="posted-on"><span class="screen-reader-text">%1$s </span><a href="%2$s" rel="bookmark">%3$s</a></span>', + _x( 'Posted on', 'Used before publish date.', 'twentyfifteen' ), + esc_url( get_permalink() ), + $time_string ); } - $tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen' ) ); - if ( $tags_list && ! is_wp_error( $tags_list ) ) { - printf( '<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', - _x( 'Tags', 'Used before tag names.', 'twentyfifteen' ), - $tags_list - ); + if ( 'post' == get_post_type() ) { + if ( is_singular() || is_multi_author() ) { + printf( + '<span class="byline"><span class="author vcard"><span class="screen-reader-text">%1$s </span><a class="url fn n" href="%2$s">%3$s</a></span></span>', + _x( 'Author', 'Used before post author name.', 'twentyfifteen' ), + esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), + get_the_author() + ); + } + + $categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen' ) ); + if ( $categories_list && twentyfifteen_categorized_blog() ) { + printf( + '<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', + _x( 'Categories', 'Used before category names.', 'twentyfifteen' ), + $categories_list + ); + } + + $tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen' ) ); + if ( $tags_list && ! is_wp_error( $tags_list ) ) { + printf( + '<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', + _x( 'Tags', 'Used before tag names.', 'twentyfifteen' ), + $tags_list + ); + } } - } - if ( is_attachment() && wp_attachment_is_image() ) { - // Retrieve attachment metadata. - $metadata = wp_get_attachment_metadata(); + if ( is_attachment() && wp_attachment_is_image() ) { + // Retrieve attachment metadata. + $metadata = wp_get_attachment_metadata(); - printf( '<span class="full-size-link"><span class="screen-reader-text">%1$s </span><a href="%2$s">%3$s × %4$s</a></span>', - _x( 'Full size', 'Used before full size attachment link.', 'twentyfifteen' ), - esc_url( wp_get_attachment_url() ), - $metadata['width'], - $metadata['height'] - ); - } + printf( + '<span class="full-size-link"><span class="screen-reader-text">%1$s </span><a href="%2$s">%3$s × %4$s</a></span>', + _x( 'Full size', 'Used before full size attachment link.', 'twentyfifteen' ), + esc_url( wp_get_attachment_url() ), + $metadata['width'], + $metadata['height'] + ); + } - if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { - echo '<span class="comments-link">'; - /* translators: %s: post title */ - comments_popup_link( sprintf( __( 'Leave a comment<span class="screen-reader-text"> on %s</span>', 'twentyfifteen' ), get_the_title() ) ); - echo '</span>'; + if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { + echo '<span class="comments-link">'; + /* translators: %s: post title */ + comments_popup_link( sprintf( __( 'Leave a comment<span class="screen-reader-text"> on %s</span>', 'twentyfifteen' ), get_the_title() ) ); + echo '</span>'; + } } -} endif; /** @@ -136,13 +143,15 @@ endif; function twentyfifteen_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'twentyfifteen_categories' ) ) ) { // Create an array of all the categories that are attached to posts. - $all_the_cool_cats = get_categories( array( - 'fields' => 'ids', - 'hide_empty' => 1, + $all_the_cool_cats = get_categories( + array( + 'fields' => 'ids', + 'hide_empty' => 1, - // We only need to know if there is more than one category. - 'number' => 2, - ) ); + // We only need to know if there is more than one category. + 'number' => 2, + ) + ); // Count the number of categories that are attached to the posts. $all_the_cool_cats = count( $all_the_cool_cats ); @@ -169,27 +178,27 @@ function twentyfifteen_category_transient_flusher() { delete_transient( 'twentyfifteen_categories' ); } add_action( 'edit_category', 'twentyfifteen_category_transient_flusher' ); -add_action( 'save_post', 'twentyfifteen_category_transient_flusher' ); +add_action( 'save_post', 'twentyfifteen_category_transient_flusher' ); if ( ! function_exists( 'twentyfifteen_post_thumbnail' ) ) : -/** - * Display an optional post thumbnail. - * - * Wraps the post thumbnail in an anchor element on index views, or a div - * element when on single views. - * - * @since Twenty Fifteen 1.0 - */ -function twentyfifteen_post_thumbnail() { - if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) { - return; - } + /** + * Display an optional post thumbnail. + * + * Wraps the post thumbnail in an anchor element on index views, or a div + * element when on single views. + * + * @since Twenty Fifteen 1.0 + */ + function twentyfifteen_post_thumbnail() { + if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) { + return; + } - if ( is_singular() ) : - ?> + if ( is_singular() ) : + ?> - <div class="post-thumbnail"> - <?php the_post_thumbnail(); ?> + <div class="post-thumbnail"> + <?php the_post_thumbnail(); ?> </div><!-- .post-thumbnail --> <?php else : ?> @@ -200,59 +209,61 @@ function twentyfifteen_post_thumbnail() { ?> </a> - <?php endif; // End is_singular() -} + <?php + endif; // End is_singular() + } endif; if ( ! function_exists( 'twentyfifteen_get_link_url' ) ) : -/** - * Return the post URL. - * - * Falls back to the post permalink if no URL is found in the post. - * - * @since Twenty Fifteen 1.0 - * - * @see get_url_in_content() - * - * @return string The Link format URL. - */ -function twentyfifteen_get_link_url() { - $has_url = get_url_in_content( get_the_content() ); + /** + * Return the post URL. + * + * Falls back to the post permalink if no URL is found in the post. + * + * @since Twenty Fifteen 1.0 + * + * @see get_url_in_content() + * + * @return string The Link format URL. + */ + function twentyfifteen_get_link_url() { + $has_url = get_url_in_content( get_the_content() ); - return $has_url ? $has_url : apply_filters( 'the_permalink', get_permalink() ); -} + return $has_url ? $has_url : apply_filters( 'the_permalink', get_permalink() ); + } endif; if ( ! function_exists( 'twentyfifteen_excerpt_more' ) && ! is_admin() ) : -/** - * Replaces "[...]" (appended to automatically generated excerpts) with ... and a 'Continue reading' link. - * - * @since Twenty Fifteen 1.0 - * - * @return string 'Continue reading' link prepended with an ellipsis. - */ -function twentyfifteen_excerpt_more( $more ) { - $link = sprintf( '<a href="%1$s" class="more-link">%2$s</a>', - esc_url( get_permalink( get_the_ID() ) ), - /* translators: %s: Name of current post */ - sprintf( __( 'Continue reading %s', 'twentyfifteen' ), '<span class="screen-reader-text">' . get_the_title( get_the_ID() ) . '</span>' ) + /** + * Replaces "[...]" (appended to automatically generated excerpts) with ... and a 'Continue reading' link. + * + * @since Twenty Fifteen 1.0 + * + * @return string 'Continue reading' link prepended with an ellipsis. + */ + function twentyfifteen_excerpt_more( $more ) { + $link = sprintf( + '<a href="%1$s" class="more-link">%2$s</a>', + esc_url( get_permalink( get_the_ID() ) ), + /* translators: %s: Name of current post */ + sprintf( __( 'Continue reading %s', 'twentyfifteen' ), '<span class="screen-reader-text">' . get_the_title( get_the_ID() ) . '</span>' ) ); - return ' … ' . $link; -} -add_filter( 'excerpt_more', 'twentyfifteen_excerpt_more' ); + return ' … ' . $link; + } + add_filter( 'excerpt_more', 'twentyfifteen_excerpt_more' ); endif; if ( ! function_exists( 'twentyfifteen_the_custom_logo' ) ) : -/** - * Displays the optional custom logo. - * - * Does nothing if the custom logo is not available. - * - * @since Twenty Fifteen 1.5 - */ -function twentyfifteen_the_custom_logo() { - if ( function_exists( 'the_custom_logo' ) ) { - the_custom_logo(); + /** + * Displays the optional custom logo. + * + * Does nothing if the custom logo is not available. + * + * @since Twenty Fifteen 1.5 + */ + function twentyfifteen_the_custom_logo() { + if ( function_exists( 'the_custom_logo' ) ) { + the_custom_logo(); + } } -} endif; diff --git a/themes/twentyfifteen/index.php b/themes/twentyfifteen/index.php index db77651e..4abac6a1 100644 --- a/themes/twentyfifteen/index.php +++ b/themes/twentyfifteen/index.php @@ -7,7 +7,7 @@ * It is used to display a page when nothing more specific matches a query. * e.g., it puts together the home page when no home.php file exists. * - * Learn more: {@link https://codex.wordpress.org/Template_Hierarchy} + * Learn more: {@link https://developer.wordpress.org/themes/basics/template-hierarchy/} * * @package WordPress * @subpackage Twenty_Fifteen @@ -29,7 +29,8 @@ get_header(); ?> <?php // Start the loop. - while ( have_posts() ) : the_post(); + while ( have_posts() ) : + the_post(); /* * Include the Post-Format-specific template for the content. @@ -38,17 +39,19 @@ get_header(); ?> */ get_template_part( 'content', get_post_format() ); - // End the loop. + // End the loop. endwhile; // Previous/next page navigation. - the_posts_pagination( array( - 'prev_text' => __( 'Previous page', 'twentyfifteen' ), - 'next_text' => __( 'Next page', 'twentyfifteen' ), - 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>', - ) ); + the_posts_pagination( + array( + 'prev_text' => __( 'Previous page', 'twentyfifteen' ), + 'next_text' => __( 'Next page', 'twentyfifteen' ), + 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>', + ) + ); - // If no content, include the "No posts found" template. + // If no content, include the "No posts found" template. else : get_template_part( 'content', 'none' ); diff --git a/themes/twentyfifteen/js/functions.js b/themes/twentyfifteen/js/functions.js index 2da5cbc3..b9dddc85 100644 --- a/themes/twentyfifteen/js/functions.js +++ b/themes/twentyfifteen/js/functions.js @@ -77,7 +77,8 @@ } )(); /** - * @summary Add or remove ARIA attributes. + * Add or remove ARIA attributes. + * * Uses jQuery's width() function to determine the size of the window and add * the default ARIA attributes for the menu toggle if it's visible. * @since Twenty Fifteen 1.1 diff --git a/themes/twentyfifteen/page.php b/themes/twentyfifteen/page.php index 5c7a0b07..50d0bf1c 100644 --- a/themes/twentyfifteen/page.php +++ b/themes/twentyfifteen/page.php @@ -18,7 +18,8 @@ get_header(); ?> <?php // Start the loop. - while ( have_posts() ) : the_post(); + while ( have_posts() ) : + the_post(); // Include the page content template. get_template_part( 'content', 'page' ); @@ -28,7 +29,7 @@ get_header(); ?> comments_template(); endif; - // End the loop. + // End the loop. endwhile; ?> diff --git a/themes/twentyfifteen/readme.txt b/themes/twentyfifteen/readme.txt index 7bc7d625..a28aa0cf 100644 --- a/themes/twentyfifteen/readme.txt +++ b/themes/twentyfifteen/readme.txt @@ -2,7 +2,7 @@ Contributors: the WordPress team Requires at least: WordPress 4.1 Tested up to: WordPress 5.0 -Version: 2.2 +Version: 2.4 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Tags: blog, two-columns, left-sidebar, accessibility-ready, custom-background, custom-colors, custom-header, custom-logo, custom-menu, editor-style, featured-images, microformats, post-formats, rtl-language-support, sticky-post, threaded-comments, translation-ready @@ -55,6 +55,16 @@ Source: http://www.genericons.com == Changelog == += 2.4 = +* Released: February 21, 2019 + +https://codex.wordpress.org/Twenty_Fifteen_Theme_Changelog#Version_2.4 + += 2.3 = +* Released: January 9, 2019 + +https://codex.wordpress.org/Twenty_Fifteen_Theme_Changelog#Version_2.3 + = 2.2 = * Released: December 19, 2018 diff --git a/themes/twentyfifteen/search.php b/themes/twentyfifteen/search.php index 33528415..f3778f34 100644 --- a/themes/twentyfifteen/search.php +++ b/themes/twentyfifteen/search.php @@ -20,7 +20,9 @@ get_header(); ?> <?php // Start the loop. - while ( have_posts() ) : the_post(); ?> + while ( have_posts() ) : + the_post(); + ?> <?php /* @@ -30,17 +32,19 @@ get_header(); ?> */ get_template_part( 'content', 'search' ); - // End the loop. + // End the loop. endwhile; // Previous/next page navigation. - the_posts_pagination( array( - 'prev_text' => __( 'Previous page', 'twentyfifteen' ), - 'next_text' => __( 'Next page', 'twentyfifteen' ), - 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>', - ) ); - - // If no content, include the "No posts found" template. + the_posts_pagination( + array( + 'prev_text' => __( 'Previous page', 'twentyfifteen' ), + 'next_text' => __( 'Next page', 'twentyfifteen' ), + 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>', + ) + ); + + // If no content, include the "No posts found" template. else : get_template_part( 'content', 'none' ); diff --git a/themes/twentyfifteen/sidebar.php b/themes/twentyfifteen/sidebar.php index 02308efc..f2326a8c 100644 --- a/themes/twentyfifteen/sidebar.php +++ b/themes/twentyfifteen/sidebar.php @@ -7,17 +7,19 @@ * @since Twenty Fifteen 1.0 */ -if ( has_nav_menu( 'primary' ) || has_nav_menu( 'social' ) || is_active_sidebar( 'sidebar-1' ) ) : ?> +if ( has_nav_menu( 'primary' ) || has_nav_menu( 'social' ) || is_active_sidebar( 'sidebar-1' ) ) : ?> <div id="secondary" class="secondary"> <?php if ( has_nav_menu( 'primary' ) ) : ?> <nav id="site-navigation" class="main-navigation" role="navigation"> <?php // Primary navigation menu. - wp_nav_menu( array( - 'menu_class' => 'nav-menu', - 'theme_location' => 'primary', - ) ); + wp_nav_menu( + array( + 'menu_class' => 'nav-menu', + 'theme_location' => 'primary', + ) + ); ?> </nav><!-- .main-navigation --> <?php endif; ?> @@ -26,12 +28,14 @@ if ( has_nav_menu( 'primary' ) || has_nav_menu( 'social' ) || is_active_sidebar( <nav id="social-navigation" class="social-navigation" role="navigation"> <?php // Social links navigation menu. - wp_nav_menu( array( - 'theme_location' => 'social', - 'depth' => 1, - 'link_before' => '<span class="screen-reader-text">', - 'link_after' => '</span>', - ) ); + wp_nav_menu( + array( + 'theme_location' => 'social', + 'depth' => 1, + 'link_before' => '<span class="screen-reader-text">', + 'link_after' => '</span>', + ) + ); ?> </nav><!-- .social-navigation --> <?php endif; ?> diff --git a/themes/twentyfifteen/single.php b/themes/twentyfifteen/single.php index fda8b5ec..4de3a493 100644 --- a/themes/twentyfifteen/single.php +++ b/themes/twentyfifteen/single.php @@ -14,7 +14,8 @@ get_header(); ?> <?php // Start the loop. - while ( have_posts() ) : the_post(); + while ( have_posts() ) : + the_post(); /* * Include the post format-specific template for the content. If you want to @@ -29,16 +30,18 @@ get_header(); ?> endif; // Previous/next post navigation. - the_post_navigation( array( - 'next_text' => '<span class="meta-nav" aria-hidden="true">' . __( 'Next', 'twentyfifteen' ) . '</span> ' . - '<span class="screen-reader-text">' . __( 'Next post:', 'twentyfifteen' ) . '</span> ' . - '<span class="post-title">%title</span>', - 'prev_text' => '<span class="meta-nav" aria-hidden="true">' . __( 'Previous', 'twentyfifteen' ) . '</span> ' . - '<span class="screen-reader-text">' . __( 'Previous post:', 'twentyfifteen' ) . '</span> ' . - '<span class="post-title">%title</span>', - ) ); - - // End the loop. + the_post_navigation( + array( + 'next_text' => '<span class="meta-nav" aria-hidden="true">' . __( 'Next', 'twentyfifteen' ) . '</span> ' . + '<span class="screen-reader-text">' . __( 'Next post:', 'twentyfifteen' ) . '</span> ' . + '<span class="post-title">%title</span>', + 'prev_text' => '<span class="meta-nav" aria-hidden="true">' . __( 'Previous', 'twentyfifteen' ) . '</span> ' . + '<span class="screen-reader-text">' . __( 'Previous post:', 'twentyfifteen' ) . '</span> ' . + '<span class="post-title">%title</span>', + ) + ); + + // End the loop. endwhile; ?> diff --git a/themes/twentyfifteen/style.css b/themes/twentyfifteen/style.css index d53b3eb2..49631ce0 100644 --- a/themes/twentyfifteen/style.css +++ b/themes/twentyfifteen/style.css @@ -4,7 +4,7 @@ Theme URI: https://wordpress.org/themes/twentyfifteen/ Author: the WordPress team Author URI: https://wordpress.org/ Description: Our 2015 default theme is clean, blog-focused, and designed for clarity. Twenty Fifteen's simple, straightforward typography is readable on a wide variety of screen sizes, and suitable for multiple languages. We designed it using a mobile-first approach, meaning your content takes center-stage, regardless of whether your visitors arrive by smartphone, tablet, laptop, or desktop computer. -Version: 2.2 +Version: 2.4 License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Tags: blog, two-columns, left-sidebar, accessibility-ready, custom-background, custom-colors, custom-header, custom-logo, custom-menu, editor-style, featured-images, microformats, post-formats, rtl-language-support, sticky-post, threaded-comments, translation-ready |