Commit 7d0a21f3 authored by lucha's avatar lucha

[auto] theme: twentysixteen 1.8

parent 885c6a56
......@@ -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.
......@@ -45,11 +46,13 @@ get_header(); ?>
endwhile;
// Previous/next page navigation.
the_posts_pagination( array(
the_posts_pagination(
array(
'prev_text' => __( 'Previous page', 'twentysixteen' ),
'next_text' => __( 'Next page', 'twentysixteen' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentysixteen' ) . ' </span>',
) );
)
);
// If no content, include the "No posts found" template.
else :
......
......@@ -50,11 +50,13 @@ if ( post_password_required() ) {
<ol class="comment-list">
<?php
wp_list_comments( array(
wp_list_comments(
array(
'style' => 'ol',
'short_ping' => true,
'avatar_size' => 42,
) );
)
);
?>
</ol><!-- .comment-list -->
......@@ -70,10 +72,12 @@ if ( post_password_required() ) {
<?php endif; ?>
<?php
comment_form( array(
comment_form(
array(
'title_reply_before' => '<h2 id="reply-title" class="comment-reply-title">',
'title_reply_after' => '</h2>',
) );
)
);
?>
</div><!-- .comments-area -->
......@@ -16,10 +16,12 @@
<?php if ( has_nav_menu( 'primary' ) ) : ?>
<nav class="main-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Footer Primary Menu', 'twentysixteen' ); ?>">
<?php
wp_nav_menu( array(
wp_nav_menu(
array(
'theme_location' => 'primary',
'menu_class' => 'primary-menu',
) );
)
);
?>
</nav><!-- .main-navigation -->
<?php endif; ?>
......@@ -27,13 +29,15 @@
<?php if ( has_nav_menu( 'social' ) ) : ?>
<nav class="social-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Footer Social Links Menu', 'twentysixteen' ); ?>">
<?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>',
) );
)
);
?>
</nav><!-- .social-navigation -->
<?php endif; ?>
......
......@@ -33,7 +33,7 @@ if ( version_compare( $GLOBALS['wp_version'], '4.4-alpha', '<' ) ) {
}
if ( ! function_exists( 'twentysixteen_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
......@@ -44,7 +44,7 @@ if ( ! function_exists( 'twentysixteen_setup' ) ) :
*
* @since Twenty Sixteen 1.0
*/
function twentysixteen_setup() {
function twentysixteen_setup() {
/*
* Make theme available for translation.
* Translations can be filed at WordPress.org. See: https://translate.wordpress.org/projects/wp-themes/twentysixteen
......@@ -69,11 +69,14 @@ function twentysixteen_setup() {
*
* @since Twenty Sixteen 1.2
*/
add_theme_support( 'custom-logo', array(
add_theme_support(
'custom-logo',
array(
'height' => 240,
'width' => 240,
'flex-height' => true,
) );
)
);
/*
* Enable support for Post Thumbnails on posts and pages.
......@@ -84,29 +87,36 @@ function twentysixteen_setup() {
set_post_thumbnail_size( 1200, 9999 );
// This theme uses wp_nav_menu() in two locations.
register_nav_menus( array(
register_nav_menus(
array(
'primary' => __( 'Primary Menu', 'twentysixteen' ),
'social' => __( 'Social Links Menu', 'twentysixteen' ),
) );
)
);
/*
* 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(
'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(
add_theme_support(
'post-formats',
array(
'aside',
'image',
'video',
......@@ -116,7 +126,8 @@ function twentysixteen_setup() {
'status',
'audio',
'chat',
) );
)
);
/*
* This theme styles the visual editor to resemble the theme style,
......@@ -134,7 +145,9 @@ function twentysixteen_setup() {
add_theme_support( 'responsive-embeds' );
// Add support for custom color scheme.
add_theme_support( 'editor-color-palette', array(
add_theme_support(
'editor-color-palette',
array(
array(
'name' => __( 'Dark Gray', 'twentysixteen' ),
'slug' => 'dark-gray',
......@@ -195,11 +208,12 @@ function twentysixteen_setup() {
'slug' => 'yellow',
'color' => '#ffef8e',
),
) );
)
);
// Indicate widget sidebars can use selective refresh in the Customizer.
add_theme_support( 'customize-selective-refresh-widgets' );
}
}
endif; // twentysixteen_setup
add_action( 'after_setup_theme', 'twentysixteen_setup' );
......@@ -225,7 +239,8 @@ add_action( 'after_setup_theme', 'twentysixteen_content_width', 0 );
* @since Twenty Sixteen 1.0
*/
function twentysixteen_widgets_init() {
register_sidebar( array(
register_sidebar(
array(
'name' => __( 'Sidebar', 'twentysixteen' ),
'id' => 'sidebar-1',
'description' => __( 'Add widgets here to appear in your sidebar.', 'twentysixteen' ),
......@@ -233,9 +248,11 @@ function twentysixteen_widgets_init() {
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );
)
);
register_sidebar( array(
register_sidebar(
array(
'name' => __( 'Content Bottom 1', 'twentysixteen' ),
'id' => 'sidebar-2',
'description' => __( 'Appears at the bottom of the content on posts and pages.', 'twentysixteen' ),
......@@ -243,9 +260,11 @@ function twentysixteen_widgets_init() {
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );
)
);
register_sidebar( array(
register_sidebar(
array(
'name' => __( 'Content Bottom 2', 'twentysixteen' ),
'id' => 'sidebar-3',
'description' => __( 'Appears at the bottom of the content on posts and pages.', 'twentysixteen' ),
......@@ -253,12 +272,13 @@ function twentysixteen_widgets_init() {
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );
)
);
}
add_action( 'widgets_init', 'twentysixteen_widgets_init' );
if ( ! function_exists( 'twentysixteen_fonts_url' ) ) :
/**
/**
* Register Google fonts for Twenty Sixteen.
*
* Create your own twentysixteen_fonts_url() function to override in a child theme.
......@@ -267,7 +287,7 @@ if ( ! function_exists( 'twentysixteen_fonts_url' ) ) :
*
* @return string Google fonts URL for the theme.
*/
function twentysixteen_fonts_url() {
function twentysixteen_fonts_url() {
$fonts_url = '';
$fonts = array();
$subsets = 'latin,latin-ext';
......@@ -288,14 +308,17 @@ function twentysixteen_fonts_url() {
}
if ( $fonts ) {
$fonts_url = add_query_arg( array(
$fonts_url = add_query_arg(
array(
'family' => urlencode( implode( '|', $fonts ) ),
'subset' => urlencode( $subsets ),
), 'https://fonts.googleapis.com/css' );
),
'https://fonts.googleapis.com/css'
);
}
return $fonts_url;
}
}
endif;
/**
......@@ -356,10 +379,14 @@ function twentysixteen_scripts() {
wp_enqueue_script( 'twentysixteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20181230', true );
wp_localize_script( 'twentysixteen-script', 'screenReaderText', array(
wp_localize_script(
'twentysixteen-script',
'screenReaderText',
array(
'expand' => __( 'expand child menu', 'twentysixteen' ),
'collapse' => __( 'collapse child menu', 'twentysixteen' ),
) );
)
);
}
add_action( 'wp_enqueue_scripts', 'twentysixteen_scripts' );
......@@ -422,10 +449,10 @@ function twentysixteen_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 ) );
......@@ -433,7 +460,11 @@ function twentysixteen_hex2rgb( $color ) {
return array();
}
return array( 'red' => $r, 'green' => $g, 'blue' => $b );
return array(
'red' => $r,
'green' => $g,
'blue' => $b,
);
}
/**
......@@ -478,7 +509,7 @@ function twentysixteen_content_image_sizes_attr( $sizes, $size ) {
return $sizes;
}
add_filter( 'wp_calculate_image_sizes', 'twentysixteen_content_image_sizes_attr', 10 , 2 );
add_filter( 'wp_calculate_image_sizes', 'twentysixteen_content_image_sizes_attr', 10, 2 );
/**
* Add custom image sizes attribute to enhance responsive image functionality
......@@ -501,7 +532,7 @@ function twentysixteen_post_thumbnail_sizes_attr( $attr, $attachment, $size ) {
}
return $attr;
}
add_filter( 'wp_get_attachment_image_attributes', 'twentysixteen_post_thumbnail_sizes_attr', 10 , 3 );
add_filter( 'wp_get_attachment_image_attributes', 'twentysixteen_post_thumbnail_sizes_attr', 10, 3 );
/**
* Modifies tag cloud widget arguments to display all tags in the same font size
......
......@@ -35,10 +35,12 @@
<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; ?>
</div><!-- .site-branding -->
......@@ -50,10 +52,12 @@
<?php if ( has_nav_menu( 'primary' ) ) : ?>
<nav id="site-navigation" class="main-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Primary Menu', 'twentysixteen' ); ?>">
<?php
wp_nav_menu( array(
wp_nav_menu(
array(
'theme_location' => 'primary',
'menu_class' => 'primary-menu',
) );
)
);
?>
</nav><!-- .main-navigation -->
<?php endif; ?>
......@@ -61,13 +65,15 @@
<?php if ( has_nav_menu( 'social' ) ) : ?>
<nav id="social-navigation" class="social-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Social Links Menu', 'twentysixteen' ); ?>">
<?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>',
) );
)
);
?>
</nav><!-- .social-navigation -->
<?php endif; ?>
......
......@@ -14,7 +14,8 @@ 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(); ?>>
......@@ -52,14 +53,16 @@ get_header(); ?>
<?php
the_content();
wp_link_pages( array(
wp_link_pages(
array(
'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentysixteen' ) . '</span>',
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>',
'pagelink' => '<span class="screen-reader-text">' . __( 'Page', 'twentysixteen' ) . ' </span>%',
'separator' => '<span class="screen-reader-text">, </span>',
) );
)
);
?>
</div><!-- .entry-content -->
......@@ -69,7 +72,8 @@ get_header(); ?>
// Retrieve attachment metadata.
$metadata = wp_get_attachment_metadata();
if ( $metadata ) {
printf( '<span class="full-size-link"><span class="screen-reader-text">%1$s </span><a href="%2$s">%3$s &times; %4$s</a></span>',
printf(
'<span class="full-size-link"><span class="screen-reader-text">%1$s </span><a href="%2$s">%3$s &times; %4$s</a></span>',
esc_html_x( 'Full size', 'Used before full size attachment link.', 'twentysixteen' ),
esc_url( wp_get_attachment_url() ),
absint( $metadata['width'] ),
......@@ -98,9 +102,11 @@ get_header(); ?>
}
// Parent post navigation.
the_post_navigation( array(
the_post_navigation(
array(
'prev_text' => _x( '<span class="meta-nav">Published in</span><span class="post-title">%title</span>', 'Parent post link', 'twentysixteen' ),
) );
)
);
// End the loop.
endwhile;
?>
......
......@@ -50,9 +50,13 @@ function twentysixteen_upgrade_notice() {
* @global string $wp_version WordPress version.
*/
function twentysixteen_customize() {
wp_die( sprintf( __( 'Twenty Sixteen requires at least WordPress version 4.4. You are running version %s. Please upgrade and try again.', 'twentysixteen' ), $GLOBALS['wp_version'] ), '', array(
wp_die(
sprintf( __( 'Twenty Sixteen requires at least WordPress version 4.4. You are running version %s. Please upgrade and try again.', 'twentysixteen' ), $GLOBALS['wp_version'] ),
'',
array(
'back_link' => true,
) );
)
);
}
add_action( 'load-customize.php', 'twentysixteen_customize' );
......
......@@ -30,9 +30,15 @@ function twentysixteen_custom_header_and_background() {
* @type string $default-color Default color of the background.
* }
*/
add_theme_support( 'custom-background', apply_filters( 'twentysixteen_custom_background_args', array(
add_theme_support(
'custom-background',
apply_filters(
'twentysixteen_custom_background_args',
array(
'default-color' => $default_background_color,
) ) );
)
)
);
/**
* Filter the arguments used when adding 'custom-header' support in Twenty Sixteen.
......@@ -50,18 +56,24 @@ function twentysixteen_custom_header_and_background() {
* displayed on the blog.
* }
*/
add_theme_support( 'custom-header', apply_filters( 'twentysixteen_custom_header_args', array(
add_theme_support(
'custom-header',
apply_filters(
'twentysixteen_custom_header_args',
array(
'default-text-color' => $default_text_color,
'width' => 1200,
'height' => 280,
'flex-height' => true,
'wp-head-callback' => 'twentysixteen_header_style',
) ) );
)
)
);
}
add_action( 'after_setup_theme', 'twentysixteen_custom_header_and_background' );
if ( ! function_exists( 'twentysixteen_header_style' ) ) :
/**
/**
* Styles the header text displayed on the site.
*
* Create your own twentysixteen_header_style() function to override in a child theme.
......@@ -70,7 +82,7 @@ if ( ! function_exists( 'twentysixteen_header_style' ) ) :
*
* @see twentysixteen_custom_header_and_background().
*/
function twentysixteen_header_style() {
function twentysixteen_header_style() {
// If the header text option is untouched, let's bail.
if ( display_header_text() ) {
return;
......@@ -90,7 +102,7 @@ function twentysixteen_header_style() {
}
</style>
<?php
}
}
endif; // twentysixteen_header_style
/**
......@@ -107,83 +119,131 @@ function twentysixteen_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(
$wp_customize->selective_refresh->add_partial(
'blogname',
array(
'selector' => '.site-title a',
'container_inclusive' => false,
'render_callback' => 'twentysixteen_customize_partial_blogname',
) );
$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
)
);
$wp_customize->selective_refresh->add_partial(
'blogdescription',
array(
'selector' => '.site-description',
'container_inclusive' => false,
'render_callback' => 'twentysixteen_customize_partial_blogdescription',
) );
)
);
}
// Add color scheme setting and control.
$wp_customize->add_setting( 'color_scheme', array(
$wp_customize->add_setting(
'color_scheme',
array(
'default' => 'default',
'sanitize_callback' => 'twentysixteen_sanitize_color_scheme',
'transport' => 'postMessage',
) );
)
);
$wp_customize->add_control( 'color_scheme', array(
$wp_customize->add_control(
'color_scheme',
array(
'label' => __( 'Base Color Scheme', 'twentysixteen' ),
'section' => 'colors',
'type' => 'select',
'choices' => twentysixteen_get_color_scheme_choices(),
'priority' => 1,
) );
)
);
// Add page background color setting and control.
$wp_customize->add_setting( 'page_background_color', array(
$wp_customize->add_setting(
'page_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, 'page_background_color', array(
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'page_background_color',
array(
'label' => __( 'Page Background Color', 'twentysixteen' ),
'section' => 'colors',
) ) );
)
)
);
// Remove the core header textcolor control, as it shares the main text color.
$wp_customize->remove_control( 'header_textcolor' );
// Add link color setting and control.
$wp_customize->add_setting( 'link_color', array(
$wp_customize->add_setting(
'link_color',
array(
'default' => $color_scheme[2],
'sanitize_callback' => 'sanitize_hex_color',
'transport' => 'postMessage',
) );
)
);
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'link_color', array(
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'link_color',
array(
'label' => __( 'Link Color', 'twentysixteen' ),
'section' => 'colors',
) ) );
)
)
);
// Add main text color setting and control.
$wp_customize->add_setting( 'main_text_color', array(
$wp_customize->add_setting(
'main_text_color',
array(
'default' => $color_scheme[3],
'sanitize_callback' => 'sanitize_hex_color',
'transport' => 'postMessage',
) );
)
);
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'main_text_color', array(
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'main_text_color',