Commit 9f73219e authored by lucha's avatar lucha
Browse files

[auto] theme: twentyseventeen 1.7

parent 14af1a2d
......@@ -31,4 +31,5 @@ get_header(); ?>
</div><!-- #primary -->
</div><!-- .wrap -->
<?php get_footer();
<?php
get_footer();
......@@ -2,7 +2,7 @@
Contributors: the WordPress team
Requires at least: WordPress 4.7
Tested up to: WordPress 5.0-trunk
Version: 1.6
Version: 1.7
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: one-column, two-columns, right-sidebar, flexible-header, accessibility-ready, custom-colors, custom-header, custom-menu, custom-logo, editor-style, featured-images, footer-widgets, post-formats, rtl-language-support, sticky-post, theme-options, threaded-comments, translation-ready
......@@ -60,6 +60,11 @@ Source: https://unsplash.com/@englr?photo=bIhpiQA009k
== Changelog ==
= 1.7 =
* Released: August 2, 2018
https://codex.wordpress.org/Twenty_Seventeen_Theme_Changelog#Version_1.7
= 1.6 =
* Released: May 17, 2018
......
......@@ -27,10 +27,12 @@ get_header(); ?>
<main id="main" class="site-main" role="main">
<?php
if ( have_posts() ) : ?>
if ( have_posts() ) :
?>
<?php
/* Start the Loop */
while ( have_posts() ) : the_post();
while ( have_posts() ) :
the_post();
/*
* Include the Post-Format-specific template for the content.
......@@ -41,21 +43,25 @@ get_header(); ?>
endwhile;
the_posts_pagination( array(
the_posts_pagination(
array(
'prev_text' => twentyseventeen_get_svg( array( 'icon' => 'arrow-left' ) ) . '<span class="screen-reader-text">' . __( 'Previous page', 'twentyseventeen' ) . '</span>',
'next_text' => '<span class="screen-reader-text">' . __( 'Next page', 'twentyseventeen' ) . '</span>' . twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyseventeen' ) . ' </span>',
) );
)
);
else :
get_template_part( 'template-parts/post/content', 'none' );
endif; ?>
endif;
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
</div><!-- .wrap -->
<?php get_footer();
<?php
get_footer();
......@@ -236,12 +236,12 @@ ol {
counter-reset: item;
}
ol li {
ol > li {
display: block;
position: relative;
}
ol li:before {
ol > li:before {
content: counter(item);
counter-increment: item;
font-weight: 800;
......@@ -584,7 +584,7 @@ object {
counter-reset: item;
}
.rtl ol li:before {
.rtl ol > li:before {
left: auto;
right: -1.5em;
}
......
......@@ -27,7 +27,8 @@ if ( post_password_required() ) {
<?php
// You can start editing here -- including this comment!
if ( have_comments() ) : ?>
if ( have_comments() ) :
?>
<h2 class="comments-title">
<?php
$comments_number = get_comments_number();
......@@ -53,24 +54,30 @@ if ( post_password_required() ) {
<ol class="comment-list">
<?php
wp_list_comments( array(
wp_list_comments(
array(
'avatar_size' => 100,
'style' => 'ol',
'short_ping' => true,
'reply_text' => twentyseventeen_get_svg( array( 'icon' => 'mail-reply' ) ) . __( 'Reply', 'twentyseventeen' ),
) );
)
);
?>
</ol>
<?php the_comments_pagination( array(
<?php
the_comments_pagination(
array(
'prev_text' => twentyseventeen_get_svg( array( 'icon' => 'arrow-left' ) ) . '<span class="screen-reader-text">' . __( 'Previous', 'twentyseventeen' ) . '</span>',
'next_text' => '<span class="screen-reader-text">' . __( 'Next', 'twentyseventeen' ) . '</span>' . twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ),
) );
)
);
endif; // Check for have_comments().
// 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' ) ) : ?>
if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) :
?>
<p class="no-comments"><?php _e( 'Comments are closed.', 'twentyseventeen' ); ?></p>
<?php
......
......@@ -21,19 +21,23 @@
<?php
get_template_part( 'template-parts/footer/footer', 'widgets' );
if ( has_nav_menu( 'social' ) ) : ?>
if ( has_nav_menu( 'social' ) ) :
?>
<nav class="social-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Footer Social Links Menu', 'twentyseventeen' ); ?>">
<?php
wp_nav_menu( array(
wp_nav_menu(
array(
'theme_location' => 'social',
'menu_class' => 'social-links-menu',
'depth' => 1,
'link_before' => '<span class="screen-reader-text">',
'link_after' => '</span>' . twentyseventeen_get_svg( array( 'icon' => 'chain' ) ),
) );
)
);
?>
</nav><!-- .social-navigation -->
<?php endif;
<?php
endif;
get_template_part( 'template-parts/footer/site', 'info' );
?>
......
......@@ -17,14 +17,17 @@ get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php // Show the selected frontpage content.
<?php
// Show the selected front page content.
if ( have_posts() ) :
while ( have_posts() ) : the_post();
while ( have_posts() ) :
the_post();
get_template_part( 'template-parts/page/content', 'front-page' );
endwhile;
else :
get_template_part( 'template-parts/post/content', 'none' );
endif; ?>
endif;
?>
<?php
// Get each of our panels and show the post data.
......@@ -46,9 +49,11 @@ get_header(); ?>
twentyseventeen_front_page_section( null, $i );
}
endif; // The if ( 0 !== twentyseventeen_panel_count() ) ends here. ?>
endif; // The if ( 0 !== twentyseventeen_panel_count() ) ends here.
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php get_footer();
<?php
get_footer();
......@@ -59,28 +59,33 @@ function twentyseventeen_setup() {
$GLOBALS['content_width'] = 525;
// This theme uses wp_nav_menu() in two locations.
register_nav_menus( array(
register_nav_menus(
array(
'top' => __( 'Top Menu', 'twentyseventeen' ),
'social' => __( 'Social Links Menu', 'twentyseventeen' ),
) );
)
);
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
add_theme_support(
'html5', array(
'comment-form',
'comment-list',
'gallery',
'caption',
) );
)
);
/*
* Enable support for Post Formats.
*
* See: https://codex.wordpress.org/Post_Formats
*/
add_theme_support( 'post-formats', array(
add_theme_support(
'post-formats', array(
'aside',
'image',
'video',
......@@ -88,14 +93,17 @@ function twentyseventeen_setup() {
'link',
'gallery',
'audio',
) );
)
);
// Add theme support for Custom Logo.
add_theme_support( 'custom-logo', array(
add_theme_support(
'custom-logo', array(
'width' => 250,
'height' => 250,
'flex-width' => true,
) );
)
);
// Add theme support for selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' );
......@@ -311,7 +319,8 @@ add_filter( 'wp_resource_hints', 'twentyseventeen_resource_hints', 10, 2 );
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function twentyseventeen_widgets_init() {
register_sidebar( array(
register_sidebar(
array(
'name' => __( 'Blog Sidebar', 'twentyseventeen' ),
'id' => 'sidebar-1',
'description' => __( 'Add widgets here to appear in your sidebar on blog posts and archive pages.', 'twentyseventeen' ),
......@@ -319,9 +328,11 @@ function twentyseventeen_widgets_init() {
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );
)
);
register_sidebar( array(
register_sidebar(
array(
'name' => __( 'Footer 1', 'twentyseventeen' ),
'id' => 'sidebar-2',
'description' => __( 'Add widgets here to appear in your footer.', 'twentyseventeen' ),
......@@ -329,9 +340,11 @@ function twentyseventeen_widgets_init() {
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );
)
);
register_sidebar( array(
register_sidebar(
array(
'name' => __( 'Footer 2', 'twentyseventeen' ),
'id' => 'sidebar-3',
'description' => __( 'Add widgets here to appear in your footer.', 'twentyseventeen' ),
......@@ -339,7 +352,8 @@ function twentyseventeen_widgets_init() {
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );
)
);
}
add_action( 'widgets_init', 'twentyseventeen_widgets_init' );
......@@ -357,7 +371,8 @@ function twentyseventeen_excerpt_more( $link ) {
return $link;
}
$link = sprintf( '<p class="link-more"><a href="%1$s" class="more-link">%2$s</a></p>',
$link = sprintf(
'<p class="link-more"><a href="%1$s" class="more-link">%2$s</a></p>',
esc_url( get_permalink( get_the_ID() ) ),
/* translators: %s: Name of current post */
sprintf( __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen' ), get_the_title( get_the_ID() ) )
......@@ -398,11 +413,17 @@ function twentyseventeen_colors_css_wrap() {
require_once( get_parent_theme_file_path( '/inc/color-patterns.php' ) );
$hue = absint( get_theme_mod( 'colorscheme_hue', 250 ) );
$customize_preview_data_hue = '';
if ( is_customize_preview() ) {
$customize_preview_data_hue = 'data-hue="' . $hue . '"';
}
?>
<style type="text/css" id="custom-theme-colors" <?php if ( is_customize_preview() ) { echo 'data-hue="' . $hue . '"'; } ?>>
<style type="text/css" id="custom-theme-colors" <?php echo $customize_preview_data_hue; ?>>
<?php echo twentyseventeen_custom_colors_css(); ?>
</style>
<?php }
<?php
}
add_action( 'wp_head', 'twentyseventeen_colors_css_wrap' );
/**
......@@ -444,7 +465,12 @@ function twentyseventeen_scripts() {
wp_enqueue_script( 'twentyseventeen-navigation', get_theme_file_uri( '/assets/js/navigation.js' ), array( 'jquery' ), '1.0', true );
$twentyseventeen_l10n['expand'] = __( 'Expand child menu', 'twentyseventeen' );
$twentyseventeen_l10n['collapse'] = __( 'Collapse child menu', 'twentyseventeen' );
$twentyseventeen_l10n['icon'] = twentyseventeen_get_svg( array( 'icon' => 'angle-down', 'fallback' => true ) );
$twentyseventeen_l10n['icon'] = twentyseventeen_get_svg(
array(
'icon' => 'angle-down',
'fallback' => true,
)
);
}
wp_enqueue_script( 'twentyseventeen-global', get_theme_file_uri( '/assets/js/global.js' ), array( 'jquery' ), '1.0', true );
......
......@@ -48,9 +48,11 @@ function twentyseventeen_upgrade_notice() {
* @global string $wp_version WordPress version.
*/
function twentyseventeen_customize() {
wp_die( sprintf( __( 'Twenty Seventeen requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'twentyseventeen' ), $GLOBALS['wp_version'] ), '', array(
wp_die(
sprintf( __( 'Twenty Seventeen requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'twentyseventeen' ), $GLOBALS['wp_version'] ), '', array(
'back_link' => true,
) );
)
);
}
add_action( 'load-customize.php', 'twentyseventeen_customize' );
......
......@@ -33,32 +33,38 @@ function twentyseventeen_custom_header_setup() {
* @type string $flex-height Flex support for height of header.
* }
*/
add_theme_support( 'custom-header', apply_filters( 'twentyseventeen_custom_header_args', array(
add_theme_support(
'custom-header', apply_filters(
'twentyseventeen_custom_header_args', array(
'default-image' => get_parent_theme_file_uri( '/assets/images/header.jpg' ),
'width' => 2000,
'height' => 1200,
'flex-height' => true,
'video' => true,
'wp-head-callback' => 'twentyseventeen_header_style',
) ) );
)
)
);
register_default_headers( array(
register_default_headers(
array(
'default-image' => array(
'url' => '%s/assets/images/header.jpg',
'thumbnail_url' => '%s/assets/images/header.jpg',
'description' => __( 'Default Header Image', 'twentyseventeen' ),
),
) );
)
);
}
add_action( 'after_setup_theme', 'twentyseventeen_custom_header_setup' );
if ( ! function_exists( 'twentyseventeen_header_style' ) ) :
/**
/**
* Styles the header image and text displayed on the blog.
*
* @see twentyseventeen_custom_header_setup().
*/
function twentyseventeen_header_style() {
function twentyseventeen_header_style() {
$header_text_color = get_header_textcolor();
// If no custom options for text are set, let's bail.
......@@ -106,7 +112,7 @@ function twentyseventeen_header_style() {
<?php endif; ?>
</style>
<?php
}
}
endif; // End of twentyseventeen_header_style.
/**
......
......@@ -17,31 +17,40 @@ function twentyseventeen_customize_register( $wp_customize ) {
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
$wp_customize->selective_refresh->add_partial( 'blogname', array(
$wp_customize->selective_refresh->add_partial(
'blogname', array(
'selector' => '.site-title a',
'render_callback' => 'twentyseventeen_customize_partial_blogname',
) );
$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
)
);
$wp_customize->selective_refresh->add_partial(
'blogdescription', array(
'selector' => '.site-description',
'render_callback' => 'twentyseventeen_customize_partial_blogdescription',
) );
)
);
/**
* Custom colors.
*/
$wp_customize->add_setting( 'colorscheme', array(
$wp_customize->add_setting(
'colorscheme', array(
'default' => 'light',
'transport' => 'postMessage',
'sanitize_callback' => 'twentyseventeen_sanitize_colorscheme',
) );
)
);
$wp_customize->add_setting( 'colorscheme_hue', array(
$wp_customize->add_setting(
'colorscheme_hue', array(
'default' => 250,
'transport' => 'postMessage',
'sanitize_callback' => 'absint', // The hue is stored as a positive integer.
) );
)
);
$wp_customize->add_control( 'colorscheme', array(
$wp_customize->add_control(
'colorscheme', array(
'type' => 'radio',
'label' => __( 'Color Scheme', 'twentyseventeen' ),
'choices' => array(
......@@ -51,29 +60,39 @@ function twentyseventeen_customize_register( $wp_customize ) {
),
'section' => 'colors',
'priority' => 5,
) );
)
);
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'colorscheme_hue', array(
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize, 'colorscheme_hue', array(
'mode' => 'hue',
'section' => 'colors',
'priority' => 6,
) ) );
)
)
);
/**
* Theme options.
*/
$wp_customize->add_section( 'theme_options', array(
$wp_customize->add_section(
'theme_options', array(
'title' => __( 'Theme Options', 'twentyseventeen' ),
'priority' => 130, // Before Additional CSS.
) );
)
);
$wp_customize->add_setting( 'page_layout', array(
$wp_customize->add_setting(
'page_layout', array(
'default' => 'two-column',
'sanitize_callback' => 'twentyseventeen_sanitize_page_layout',
'transport' => 'postMessage',
) );
)
);
$wp_customize->add_control( 'page_layout', array(
$wp_customize->add_control(
'page_layout', array(
'label' => __( 'Page Layout', 'twentyseventeen' ),
'section' => 'theme_options',
'type' => 'radio',
......@@ -83,7 +102,8 @@ function twentyseventeen_customize_register( $wp_customize ) {
'two-column' => __( 'Two Column', 'twentyseventeen' ),
),
'active_callback' => 'twentyseventeen_is_view_with_layout_option',
) );
)
);
/**
* Filter number of front page sections in Twenty Seventeen.
......@@ -96,13 +116,16 @@ function twentyseventeen_customize_register( $wp_customize ) {
// Create a setting and control for each of the sections available in the theme.
for ( $i = 1; $i < ( 1 + $num_sections ); $i++ ) {
$wp_customize->add_setting( 'panel_' . $i, array(
$wp_customize->add_setting(
'panel_' . $i, array(
'default' => false,
'sanitize_callback' => 'absint',
'transport' => 'postMessage',
) );
)
);
$wp_customize->add_control( 'panel_' . $i, array(
$wp_customize->add_control(
'panel_' . $i, array(
/* translators: %d is the front page section number */
'label' => sprintf( __( 'Front Page Section %d Content', 'twentyseventeen' ), $i ),
'description' => ( 1 !== $i ? '' : __( 'Select pages to feature in each area from the dropdowns. Add an image to a section by setting a featured image in the page editor. Empty sections will not be displayed.', 'twentyseventeen' ) ),
......@@ -110,13 +133,16 @@ function twentyseventeen_customize_register( $wp_customize ) {
'type' => 'dropdown-pages',
'allow_addition' => true,
'active_callback' => 'twentyseventeen_is_static_front_page',
) );
)
);
$wp_customize->selective_refresh->add_partial( 'panel_' . $i, array(
$wp_customize->selective_refresh->add_partial(
'panel_' . $i, array(
'selector' => '#panel' . $i,
'render_callback' => 'twentyseventeen_front_page_section',
'container_inclusive' => true,
) );
)
);
}
}
add_action( 'customize_register', 'twentyseventeen_customize_register' );
......
......@@ -95,7 +95,7 @@ function twentyseventeen_panel_count() {
}
/**
* Checks to see if we're on the homepage or not.
* Checks to see if we're on the front page or not.
*/
function twentyseventeen_is_frontpage() {
return ( is_front_page() && ! is_home() );
......
......@@ -10,10 +10,10 @@
*/
if ( ! function_exists( 'twentyseventeen_posted_on' ) ) :
/**
/**
* Prints HTML with meta information for the current post-date/time and author.
*/
function twentyseventeen_posted_on() {
function twentyseventeen_posted_on() {
// Get the author name; wrap it in a link.
$byline = sprintf(
......@@ -24,21 +24,22 @@ function twentyseventeen_posted_on() {
// Finally, let's write all of this to the page.
echo '<span class="posted-on">' . twentyseventeen_time_link() . '</span><span class="byline"> ' . $byline . '</span>';
}
}
endif;
if ( ! function_exists( 'twentyseventeen_time_link' ) ) :