From 6da60564e1dd2870cfb7770c2e8dcf8a446aced6 Mon Sep 17 00:00:00 2001 From: "Anthony G. Basile" Date: Fri, 8 Jun 2018 10:12:56 -0400 Subject: Update twentyfifteen 2.0 --- themes/twentyfifteen/archive.php | 19 +- themes/twentyfifteen/comments.php | 50 ++-- themes/twentyfifteen/content-link.php | 36 +-- themes/twentyfifteen/content-page.php | 18 +- themes/twentyfifteen/content.php | 36 +-- themes/twentyfifteen/footer.php | 9 +- themes/twentyfifteen/functions.php | 370 ++++++++++++++++------------- themes/twentyfifteen/header.php | 12 +- themes/twentyfifteen/image.php | 77 +++--- themes/twentyfifteen/inc/back-compat.php | 8 +- themes/twentyfifteen/inc/custom-header.php | 70 +++--- themes/twentyfifteen/inc/customizer.php | 358 +++++++++++++++------------- themes/twentyfifteen/inc/template-tags.php | 319 +++++++++++++------------ themes/twentyfifteen/index.php | 19 +- themes/twentyfifteen/js/functions.js | 3 +- themes/twentyfifteen/page.php | 5 +- themes/twentyfifteen/readme.txt | 9 +- themes/twentyfifteen/rtl.css | 3 + themes/twentyfifteen/search.php | 22 +- themes/twentyfifteen/sidebar.php | 26 +- themes/twentyfifteen/single.php | 25 +- themes/twentyfifteen/style.css | 26 +- 22 files changed, 837 insertions(+), 683 deletions(-) diff --git a/themes/twentyfifteen/archive.php b/themes/twentyfifteen/archive.php index bb6021e3..7d100c50 100644 --- a/themes/twentyfifteen/archive.php +++ b/themes/twentyfifteen/archive.php @@ -32,7 +32,8 @@ 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' => '' . __( 'Page', 'twentyfifteen' ) . ' ', - ) ); + the_posts_pagination( + array( + 'prev_text' => __( 'Previous page', 'twentyfifteen' ), + 'next_text' => __( 'Next page', 'twentyfifteen' ), + 'before_page_number' => '' . __( 'Page', 'twentyfifteen' ) . ' ', + ) + ); - // 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..1c1b5a49 100644 --- a/themes/twentyfifteen/comments.php +++ b/themes/twentyfifteen/comments.php @@ -26,23 +26,23 @@ if ( post_password_required() ) {

@@ -50,11 +50,13 @@ if ( post_password_required() ) {
    'ol', - 'short_ping' => true, - 'avatar_size' => 56, - ) ); + wp_list_comments( + array( + 'style' => 'ol', + 'short_ping' => true, + 'avatar_size' => 56, + ) + ); ?>
@@ -64,9 +66,9 @@ if ( post_password_required() ) { -

+

diff --git a/themes/twentyfifteen/content-link.php b/themes/twentyfifteen/content-link.php index 2beb1f78..17aaf780 100644 --- a/themes/twentyfifteen/content-link.php +++ b/themes/twentyfifteen/content-link.php @@ -15,8 +15,8 @@
', esc_url( twentyfifteen_get_link_url() ) ), '' ); + if ( is_single() ) : + the_title( sprintf( '

', esc_url( twentyfifteen_get_link_url() ) ), '

' ); else : the_title( sprintf( '

', esc_url( twentyfifteen_get_link_url() ) ), '

' ); endif; @@ -27,27 +27,31 @@
', '', false ) - ) ); + the_content( + sprintf( + __( 'Continue reading %s', 'twentyfifteen' ), + the_title( '', '', false ) + ) + ); - wp_link_pages( array( - 'before' => '', - 'link_before' => '', - 'link_after' => '', - 'pagelink' => '' . __( 'Page', 'twentyfifteen' ) . ' %', - 'separator' => ', ', - ) ); + wp_link_pages( + array( + 'before' => '', + 'link_before' => '', + 'link_after' => '', + 'pagelink' => '' . __( 'Page', 'twentyfifteen' ) . ' %', + 'separator' => ', ', + ) + ); ?>
diff --git a/themes/twentyfifteen/content-page.php b/themes/twentyfifteen/content-page.php index 7d37daa7..225eaff3 100644 --- a/themes/twentyfifteen/content-page.php +++ b/themes/twentyfifteen/content-page.php @@ -21,14 +21,16 @@
'', - 'link_before' => '', - 'link_after' => '', - 'pagelink' => '' . __( 'Page', 'twentyfifteen' ) . ' %', - 'separator' => ', ', - ) ); + wp_link_pages( + array( + 'before' => '', + 'link_before' => '', + 'link_after' => '', + 'pagelink' => '' . __( 'Page', 'twentyfifteen' ) . ' %', + 'separator' => ', ', + ) + ); ?>
diff --git a/themes/twentyfifteen/content.php b/themes/twentyfifteen/content.php index 24756007..5ad15805 100644 --- a/themes/twentyfifteen/content.php +++ b/themes/twentyfifteen/content.php @@ -18,8 +18,8 @@
', '' ); + if ( is_single() ) : + the_title( '

', '

' ); else : the_title( sprintf( '

', esc_url( get_permalink() ) ), '

' ); endif; @@ -29,26 +29,30 @@
', '', false ) - ) ); + the_content( + sprintf( + __( 'Continue reading %s', 'twentyfifteen' ), + the_title( '', '', false ) + ) + ); - wp_link_pages( array( - 'before' => '', - 'link_before' => '', - 'link_after' => '', - 'pagelink' => '' . __( 'Page', 'twentyfifteen' ) . ' %', - 'separator' => ', ', - ) ); + wp_link_pages( + array( + 'before' => '', + 'link_before' => '', + 'link_after' => '', + 'pagelink' => '' . __( 'Page', 'twentyfifteen' ) . ' %', + 'separator' => ', ', + ) + ); ?>
diff --git a/themes/twentyfifteen/footer.php b/themes/twentyfifteen/footer.php index e57b5f58..6447da0e 100644 --- a/themes/twentyfifteen/footer.php +++ b/themes/twentyfifteen/footer.php @@ -22,7 +22,14 @@ */ do_action( 'twentyfifteen_credits' ); ?> - + ' ); + } + ?> + + + diff --git a/themes/twentyfifteen/functions.php b/themes/twentyfifteen/functions.php index b6161927..3f678a9b 100644 --- a/themes/twentyfifteen/functions.php +++ b/themes/twentyfifteen/functions.php @@ -42,109 +42,133 @@ 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 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 + * Sets up theme defaults and registers support for various WordPress features. * - * @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() ) ); - - // 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() ) ); + + // 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' ); @@ -156,80 +180,84 @@ 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; /** @@ -278,10 +306,12 @@ 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' ); @@ -330,9 +360,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); } @@ -341,7 +371,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..a088d85c 100644 --- a/themes/twentyfifteen/header.php +++ b/themes/twentyfifteen/header.php @@ -31,16 +31,20 @@ <?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 --> diff --git a/themes/twentyfifteen/image.php b/themes/twentyfifteen/image.php index 5a471d40..ed07d05d 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(); + while ( have_posts() ) : + the_post(); ?> - <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> + <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> - <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 --> + <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 --> - <header class="entry-header"> - <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?> - </header><!-- .entry-header --> + <header class="entry-header"> + <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?> + </header><!-- .entry-header --> - <div class="entry-content"> + <div class="entry-content"> - <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 ); - ?> + <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..2f828d6e 100644 --- a/themes/twentyfifteen/inc/back-compat.php +++ b/themes/twentyfifteen/inc/back-compat.php @@ -44,9 +44,11 @@ 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..5f90789f 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,16 @@ 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 +57,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,29 +68,33 @@ 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() ) : ?> @@ -182,7 +190,7 @@ function twentyfifteen_header_style() { <?php endif; ?> </style> <?php -} + } endif; // twentyfifteen_header_style /** diff --git a/themes/twentyfifteen/inc/customizer.php b/themes/twentyfifteen/inc/customizer.php index c31c57e8..9cc00a8a 100644 --- a/themes/twentyfifteen/inc/customizer.php +++ b/themes/twentyfifteen/inc/customizer.php @@ -21,61 +21,81 @@ 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 +165,136 @@ 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 +317,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 +370,22 @@ 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..baa98d21 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,26 +178,26 @@ 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"> + <div class="post-thumbnail"> <?php the_post_thumbnail(); ?> </div><!-- .post-thumbnail --> @@ -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..4ad3d382 100644 --- a/themes/twentyfifteen/index.php +++ b/themes/twentyfifteen/index.php @@ -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 16e131a5..8231e099 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-trunk -Version: 1.9 +Version: 2.0 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 @@ -30,7 +30,7 @@ For more information about Twenty Fifteen please go to https://codex.wordpress.o == Copyright == -Twenty Fifteen WordPress Theme, Copyright 2014-2017 WordPress.org & Automattic.com +Twenty Fifteen WordPress Theme, Copyright 2014-2018 WordPress.org & Automattic.com Twenty Fifteen is distributed under the terms of the GNU GPL This program is free software: you can redistribute it and/or modify @@ -55,6 +55,11 @@ Source: http://www.genericons.com == Changelog == += 2.0 = +* Released: May 17, 2018 + +https://codex.wordpress.org/Twenty_Fifteen_Theme_Changelog#Version_2.0 + = 1.9 = * Released: November 14, 2017 diff --git a/themes/twentyfifteen/rtl.css b/themes/twentyfifteen/rtl.css index 3c1079d0..4a7397f8 100644 --- a/themes/twentyfifteen/rtl.css +++ b/themes/twentyfifteen/rtl.css @@ -400,6 +400,9 @@ img.alignleft { float: left; } +.comment-form #wp-comment-cookies-consent { + margin: 0 0 0 10px; +} /** * 11.0 Media Queries diff --git a/themes/twentyfifteen/search.php b/themes/twentyfifteen/search.php index 33528415..174c9f6f 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 77c73116..e36ffa52 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: 1.9 +Version: 2.0 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 @@ -2406,6 +2406,18 @@ a.post-thumbnail:focus { top: -3px; } +.comment-form #wp-comment-cookies-consent { + margin: 0 10px 0 0; +} + +.comment-form .comment-form-cookies-consent label { + display: inline; + font-size: 12px; + font-size: 1.2rem; + font-weight: normal; + letter-spacing: 0; + text-transform: none; +} /** * 13.0 Footer @@ -2434,6 +2446,13 @@ a.post-thumbnail:focus { color: #333; } +.site-info span[role=separator] { + padding: 0 0.25em 0 0.5em; +} + +.site-info span[role=separator]::before { + content: '\002f'; +} /** * 14.0 Media @@ -3033,6 +3052,7 @@ p > video { .comment-awaiting-moderation, .logged-in-as, .comment-form label, + .comment-form .comment-form-cookies-consent label, .form-allowed-tags, .site-info, .wp-caption-text, @@ -3662,6 +3682,7 @@ p > video { .comment-awaiting-moderation, .logged-in-as, .comment-form label, + .comment-form .comment-form-cookies-consent label, .form-allowed-tags, .site-info, .wp-caption-text, @@ -4281,6 +4302,7 @@ p > video { .comment-awaiting-moderation, .logged-in-as, .comment-form label, + .comment-form .comment-form-cookies-consent label, .form-allowed-tags, .site-info, .wp-caption-text, @@ -4938,6 +4960,7 @@ p > video { .comment-awaiting-moderation, .logged-in-as, .comment-form label, + .comment-form .comment-form-cookies-consent label, .form-allowed-tags, .site-info, .wp-caption-text, @@ -5479,6 +5502,7 @@ p > video { .comment-awaiting-moderation, .logged-in-as, .comment-form label, + .comment-form .comment-form-cookies-consent label, .form-allowed-tags, .site-info, .wp-caption-text, -- cgit v1.2.3