summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'themes/twentysixteen/inc')
-rw-r--r--themes/twentysixteen/inc/back-compat.php24
-rw-r--r--themes/twentysixteen/inc/block-patterns.php157
-rw-r--r--themes/twentysixteen/inc/customizer.php70
-rw-r--r--themes/twentysixteen/inc/template-tags.php16
4 files changed, 222 insertions, 45 deletions
diff --git a/themes/twentysixteen/inc/back-compat.php b/themes/twentysixteen/inc/back-compat.php
index c97940e0..bf1a8d08 100644
--- a/themes/twentysixteen/inc/back-compat.php
+++ b/themes/twentysixteen/inc/back-compat.php
@@ -38,8 +38,14 @@ add_action( 'after_switch_theme', 'twentysixteen_switch_theme' );
* @global string $wp_version WordPress version.
*/
function twentysixteen_upgrade_notice() {
- $message = sprintf( __( 'Twenty Sixteen requires at least WordPress version 4.4. You are running version %s. Please upgrade and try again.', 'twentysixteen' ), $GLOBALS['wp_version'] );
- printf( '<div class="error"><p>%s</p></div>', $message );
+ printf(
+ '<div class="error"><p>%s</p></div>',
+ sprintf(
+ /* translators: %s: The current WordPress version. */
+ __( 'Twenty Sixteen requires at least WordPress version 4.4. You are running version %s. Please upgrade and try again.', 'twentysixteen' ),
+ $GLOBALS['wp_version']
+ )
+ );
}
/**
@@ -51,7 +57,11 @@ function twentysixteen_upgrade_notice() {
*/
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'] ),
+ sprintf(
+ /* translators: %s: The current WordPress version. */
+ __( '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,
@@ -69,7 +79,13 @@ add_action( 'load-customize.php', 'twentysixteen_customize' );
*/
function twentysixteen_preview() {
if ( isset( $_GET['preview'] ) ) {
- 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'] ) );
+ wp_die(
+ sprintf(
+ /* translators: %s: The current WordPress version. */
+ __( 'Twenty Sixteen requires at least WordPress version 4.4. You are running version %s. Please upgrade and try again.', 'twentysixteen' ),
+ $GLOBALS['wp_version']
+ )
+ );
}
}
add_action( 'template_redirect', 'twentysixteen_preview' );
diff --git a/themes/twentysixteen/inc/block-patterns.php b/themes/twentysixteen/inc/block-patterns.php
new file mode 100644
index 00000000..69a80b2c
--- /dev/null
+++ b/themes/twentysixteen/inc/block-patterns.php
@@ -0,0 +1,157 @@
+<?php
+/**
+ * Twenty Sixteen Theme: Block Patterns
+ *
+ * @package WordPress
+ * @subpackage Twenty_Sixteen
+ * @since Twenty Sixteen 2.3
+ */
+
+/**
+ * Register Block Pattern Category.
+ */
+if ( function_exists( 'register_block_pattern_category' ) ) {
+
+ register_block_pattern_category(
+ 'twentysixteen',
+ array( 'label' => __( 'Twenty Sixteen', 'twentysixteen' ) )
+ );
+}
+
+/**
+ * Register Block Patterns.
+ */
+if ( function_exists( 'register_block_pattern' ) ) {
+ register_block_pattern(
+ 'twentysixteen/large-heading-short-description',
+ array(
+ 'title' => __( 'Large heading with short description', 'twentysixteen' ),
+ 'categories' => array( 'twentysixteen' ),
+ 'content' => '<!-- wp:group {"align":"full","backgroundColor":"background"} -->
+ <div class="wp-block-group alignfull has-background-background-color has-background"><div class="wp-block-group__inner-container"><!-- wp:spacer {"height":60} -->
+ <div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>
+ <!-- /wp:spacer -->
+ <!-- wp:heading {"level":6,"style":{"typography":{"lineHeight":"1.5","fontSize":35}}} -->
+ <h6 style="font-size:35px;line-height:1.5"><strong>' . esc_html__( 'Twenty Sixteen is a modern take on the horizontal masthead with an optional right sidebar. It works perfectly for WordPress websites and blogs.', 'twentysixteen' ) . '</strong></h6>
+ <!-- /wp:heading -->
+ <!-- wp:paragraph {"style":{"typography":{"lineHeight":"1.8"}}} -->
+ <p style="line-height:1.8">' . esc_html__( 'Twenty Sixteen will make your WordPress website look beautiful everywhere. Take advantage of custom color options, beautiful default color schemes, a harmonious fluid grid using a mobile-first approach, and impeccable polish in every detail.', 'twentysixteen' ) . '</p>
+ <!-- /wp:paragraph -->
+ <!-- wp:spacer {"height":60} -->
+ <div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>
+ <!-- /wp:spacer --></div></div>
+ <!-- /wp:group -->',
+ )
+ );
+
+ register_block_pattern(
+ 'twentysixteen/big-title-two-columns-text',
+ array(
+ 'title' => __( 'Big Title with Two Columns Text', 'twentysixteen' ),
+ 'categories' => array( 'twentysixteen' ),
+ 'content' => '<!-- wp:spacer -->
+ <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
+ <!-- /wp:spacer -->
+
+ <!-- wp:heading {"level":1,"style":{"typography":{"fontSize":55}}} -->
+ <h1 style="font-size:55px">' . esc_html__( 'Twenty Sixteen' ) . '</h1>
+ <!-- /wp:heading -->
+
+ <!-- wp:spacer {"height":30} -->
+ <div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>
+ <!-- /wp:spacer -->
+
+ <!-- wp:columns -->
+ <div class="wp-block-columns"><!-- wp:column -->
+ <div class="wp-block-column"><!-- wp:paragraph {"dropCap":true} -->
+ <p class="has-drop-cap">' . esc_html__( 'Twenty Sixteen will make your WordPress website look beautiful everywhere. Take advantage of its custom color options and beautiful default color schemes.', 'twentysixteen' ) . '</p>
+ <!-- /wp:paragraph --></div>
+ <!-- /wp:column -->
+
+ <!-- wp:column -->
+ <div class="wp-block-column"><!-- wp:paragraph -->
+ <p>' . esc_html__( 'The theme features a harmonious fluid grid using a mobile-first approach. The layout is a modern take on the horizontal masthead with an optional right sidebar. ', 'twentysixteen' ) . '</p>
+ <!-- /wp:paragraph --></div>
+ <!-- /wp:column --></div>
+ <!-- /wp:columns -->
+
+ <!-- wp:spacer -->
+ <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
+ <!-- /wp:spacer -->',
+ )
+ );
+
+ register_block_pattern(
+ 'twentysixteen/large-blockquote',
+ array(
+ 'title' => __( 'Large Blockquote', 'twentysixteen' ),
+ 'categories' => array( 'twentysixteen' ),
+ 'content' => '<!-- wp:spacer -->
+ <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
+ <!-- /wp:spacer -->
+
+ <!-- wp:separator {"color":"dark-gray","className":"is-style-wide"} -->
+ <hr class="wp-block-separator has-text-color has-background has-dark-gray-background-color has-dark-gray-color is-style-wide"/>
+ <!-- /wp:separator -->
+
+ <!-- wp:heading {"style":{"typography":{"lineHeight":"1.5","fontSize":40}}} -->
+ <h2 style="font-size:40px;line-height:1.5"><em>' . esc_html__( 'Twenty Sixteen will make your WordPress look beautiful everywhere.', 'twentysixteen' ) . '</em></h2>
+ <!-- /wp:heading -->
+
+ <!-- wp:paragraph {"textColor":"medium-gray"} -->
+ <p class="has-medium-gray-color has-text-color">' . esc_html__( '— Takashi Irie', 'twentysixteen' ) . '</p>
+ <!-- /wp:paragraph -->
+
+ <!-- wp:spacer {"height":52} -->
+ <div style="height:52px" aria-hidden="true" class="wp-block-spacer"></div>
+ <!-- /wp:spacer -->
+
+ <!-- wp:separator {"color":"dark-gray","className":"is-style-wide"} -->
+ <hr class="wp-block-separator has-text-color has-background has-dark-gray-background-color has-dark-gray-color is-style-wide"/>
+ <!-- /wp:separator -->
+
+ <!-- wp:spacer -->
+ <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
+ <!-- /wp:spacer -->',
+ )
+ );
+
+ register_block_pattern(
+ 'twentysixteen/call-to-action',
+ array(
+ 'title' => __( 'Call to Action', 'twentysixteen' ),
+ 'categories' => array( 'twentysixteen' ),
+ 'content' => '<!-- wp:spacer -->
+ <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
+ <!-- /wp:spacer -->
+
+ <!-- wp:separator {"color":"dark-gray","className":"is-style-wide"} -->
+ <hr class="wp-block-separator has-text-color has-background has-dark-gray-background-color has-dark-gray-color is-style-wide"/>
+ <!-- /wp:separator -->
+
+ <!-- wp:heading {"level":1,"style":{"typography":{"fontSize":35,"lineHeight":"1.5"}}} -->
+ <h1 style="font-size:35px;line-height:1.5">' . esc_html__( 'My new book “Twenty Sixteen” is available for pre-order.', 'twentysixteen' ) . '</h1>
+ <!-- /wp:heading -->
+
+ <!-- wp:columns -->
+ <div class="wp-block-columns"><!-- wp:column -->
+ <div class="wp-block-column"><!-- wp:buttons -->
+ <div class="wp-block-buttons"><!-- wp:button {"borderRadius":0,"backgroundColor":"bright-blue"} -->
+ <div class="wp-block-button"><a class="wp-block-button__link has-bright-blue-background-color has-background no-border-radius">' . esc_html__( 'Pre-Order Now', 'twentysixteen' ) . '</a></div>
+ <!-- /wp:button --></div>
+ <!-- /wp:buttons --></div>
+ <!-- /wp:column -->
+
+ <!-- wp:column -->
+ <div class="wp-block-column"><!-- wp:spacer {"height":54} -->
+ <div style="height:54px" aria-hidden="true" class="wp-block-spacer"></div>
+ <!-- /wp:spacer --></div>
+ <!-- /wp:column --></div>
+ <!-- /wp:columns -->
+
+ <!-- wp:spacer -->
+ <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
+ <!-- /wp:spacer -->',
+ )
+ );
+}
diff --git a/themes/twentysixteen/inc/customizer.php b/themes/twentysixteen/inc/customizer.php
index 9867d3d9..0cefa79e 100644
--- a/themes/twentysixteen/inc/customizer.php
+++ b/themes/twentysixteen/inc/customizer.php
@@ -19,19 +19,19 @@ function twentysixteen_custom_header_and_background() {
$default_background_color = trim( $color_scheme[0], '#' );
$default_text_color = trim( $color_scheme[3], '#' );
- /**
- * Filter the arguments used when adding 'custom-background' support in Twenty Sixteen.
- *
- * @since Twenty Sixteen 1.0
- *
- * @param array $args {
- * An array of custom-background support arguments.
- *
- * @type string $default-color Default color of the background.
- * }
- */
add_theme_support(
'custom-background',
+ /**
+ * Filters the arguments used when adding 'custom-background' support in Twenty Sixteen.
+ *
+ * @since Twenty Sixteen 1.0
+ *
+ * @param array $args {
+ * An array of custom-background support arguments.
+ *
+ * @type string $default-color Default color of the background.
+ * }
+ */
apply_filters(
'twentysixteen_custom_background_args',
array(
@@ -40,24 +40,24 @@ function twentysixteen_custom_header_and_background() {
)
);
- /**
- * Filter the arguments used when adding 'custom-header' support in Twenty Sixteen.
- *
- * @since Twenty Sixteen 1.0
- *
- * @param array $args {
- * An array of custom-header support arguments.
- *
- * @type string $default-text-color Default color of the header text.
- * @type int $width Width in pixels of the custom header image. Default 1200.
- * @type int $height Height in pixels of the custom header image. Default 280.
- * @type bool $flex-height Whether to allow flexible-height header images. Default true.
- * @type callable $wp-head-callback Callback function used to style the header image and text
- * displayed on the blog.
- * }
- */
add_theme_support(
'custom-header',
+ /**
+ * Filters the arguments used when adding 'custom-header' support in Twenty Sixteen.
+ *
+ * @since Twenty Sixteen 1.0
+ *
+ * @param array $args {
+ * An array of custom-header support arguments.
+ *
+ * @type string $default-text-color Default color of the header text.
+ * @type int $width Width in pixels of the custom header image. Default 1200.
+ * @type int $height Height in pixels of the custom header image. Default 280.
+ * @type bool $flex-height Whether to allow flexible-height header images. Default true.
+ * @type callable $wp-head-callback Callback function used to style the header image and text
+ * displayed on the blog.
+ * }
+ */
apply_filters(
'twentysixteen_custom_header_args',
array(
@@ -103,7 +103,7 @@ if ( ! function_exists( 'twentysixteen_header_style' ) ) :
</style>
<?php
}
-endif; // twentysixteen_header_style
+endif; // twentysixteen_header_style()
/**
* Adds postMessage support for site title and description for the Customizer.
@@ -251,6 +251,7 @@ add_action( 'customize_register', 'twentysixteen_customize_register', 11 );
* Render the site title for the selective refresh partial.
*
* @since Twenty Sixteen 1.2
+ *
* @see twentysixteen_customize_register()
*
* @return void
@@ -263,6 +264,7 @@ function twentysixteen_customize_partial_blogname() {
* Render the site tagline for the selective refresh partial.
*
* @since Twenty Sixteen 1.2
+ *
* @see twentysixteen_customize_register()
*
* @return void
@@ -289,7 +291,7 @@ function twentysixteen_customize_partial_blogdescription() {
*/
function twentysixteen_get_color_schemes() {
/**
- * Filter the color schemes registered for use with Twenty Sixteen.
+ * Filters the color schemes registered for use with Twenty Sixteen.
*
* The default schemes include 'default', 'dark', 'gray', 'red', and 'yellow'.
*
@@ -385,7 +387,7 @@ if ( ! function_exists( 'twentysixteen_get_color_scheme' ) ) :
return $color_schemes['default']['colors'];
}
-endif; // twentysixteen_get_color_scheme
+endif; // twentysixteen_get_color_scheme()
if ( ! function_exists( 'twentysixteen_get_color_scheme_choices' ) ) :
/**
@@ -408,7 +410,7 @@ if ( ! function_exists( 'twentysixteen_get_color_scheme_choices' ) ) :
return $color_scheme_control_options;
}
-endif; // twentysixteen_get_color_scheme_choices
+endif; // twentysixteen_get_color_scheme_choices()
if ( ! function_exists( 'twentysixteen_sanitize_color_scheme' ) ) :
@@ -432,7 +434,7 @@ if ( ! function_exists( 'twentysixteen_sanitize_color_scheme' ) ) :
return $value;
}
-endif; // twentysixteen_sanitize_color_scheme
+endif; // twentysixteen_sanitize_color_scheme()
/**
* Enqueues front-end CSS for color scheme.
@@ -484,7 +486,7 @@ add_action( 'wp_enqueue_scripts', 'twentysixteen_color_scheme_css' );
* @since Twenty Sixteen 1.0
*/
function twentysixteen_customize_control_js() {
- wp_enqueue_script( 'color-scheme-control', get_template_directory_uri() . '/js/color-scheme-control.js', array( 'customize-controls', 'iris', 'underscore', 'wp-util' ), '20160816', true );
+ wp_enqueue_script( 'color-scheme-control', get_template_directory_uri() . '/js/color-scheme-control.js', array( 'customize-controls', 'iris', 'underscore', 'wp-util' ), '20170530', true );
wp_localize_script( 'color-scheme-control', 'colorScheme', twentysixteen_get_color_schemes() );
}
add_action( 'customize_controls_enqueue_scripts', 'twentysixteen_customize_control_js' );
@@ -495,7 +497,7 @@ add_action( 'customize_controls_enqueue_scripts', 'twentysixteen_customize_contr
* @since Twenty Sixteen 1.0
*/
function twentysixteen_customize_preview_js() {
- wp_enqueue_script( 'twentysixteen-customize-preview', get_template_directory_uri() . '/js/customize-preview.js', array( 'customize-preview' ), '20160816', true );
+ wp_enqueue_script( 'twentysixteen-customize-preview', get_template_directory_uri() . '/js/customize-preview.js', array( 'customize-preview' ), '20170530', true );
}
add_action( 'customize_preview_init', 'twentysixteen_customize_preview_js' );
diff --git a/themes/twentysixteen/inc/template-tags.php b/themes/twentysixteen/inc/template-tags.php
index 55578bea..005e5374 100644
--- a/themes/twentysixteen/inc/template-tags.php
+++ b/themes/twentysixteen/inc/template-tags.php
@@ -29,7 +29,7 @@ if ( ! function_exists( 'twentysixteen_entry_meta' ) ) :
);
}
- if ( in_array( get_post_type(), array( 'post', 'attachment' ) ) ) {
+ if ( in_array( get_post_type(), array( 'post', 'attachment' ), true ) ) {
twentysixteen_entry_date();
}
@@ -49,6 +49,7 @@ if ( ! function_exists( 'twentysixteen_entry_meta' ) ) :
if ( ! is_singular() && ! 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>', 'twentysixteen' ), get_the_title() ) );
echo '</span>';
}
@@ -146,7 +147,7 @@ if ( ! function_exists( 'twentysixteen_post_thumbnail' ) ) :
</a>
<?php
- endif; // End is_singular()
+ endif; // End is_singular().
}
endif;
@@ -190,7 +191,7 @@ if ( ! function_exists( 'twentysixteen_excerpt_more' ) && ! is_admin() ) :
$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 */
+ /* translators: %s: Post title. */
sprintf( __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentysixteen' ), get_the_title( get_the_ID() ) )
);
return ' &hellip; ' . $link;
@@ -209,7 +210,8 @@ if ( ! function_exists( 'twentysixteen_categorized_blog' ) ) :
* @return bool True if there is more than one category, false otherwise.
*/
function twentysixteen_categorized_blog() {
- if ( false === ( $all_the_cool_cats = get_transient( 'twentysixteen_categories' ) ) ) {
+ $all_the_cool_cats = get_transient( 'twentysixteen_categories' );
+ if ( false === $all_the_cool_cats ) {
// Create an array of all the categories that are attached to posts.
$all_the_cool_cats = get_categories(
array(
@@ -226,10 +228,10 @@ if ( ! function_exists( 'twentysixteen_categorized_blog' ) ) :
}
if ( $all_the_cool_cats > 1 || is_preview() ) {
- // This blog has more than 1 category so twentysixteen_categorized_blog should return true.
+ // This blog has more than 1 category so twentysixteen_categorized_blog() should return true.
return true;
} else {
- // This blog has only 1 category so twentysixteen_categorized_blog should return false.
+ // This blog has only 1 category so twentysixteen_categorized_blog() should return false.
return false;
}
}
@@ -269,7 +271,7 @@ if ( ! function_exists( 'wp_body_open' ) ) :
/**
* Fire the wp_body_open action.
*
- * Added for backwards compatibility to support pre 5.2.0 WordPress versions.
+ * Added for backward compatibility to support pre-5.2.0 WordPress versions.
*
* @since Twenty Sixteen 2.0
*/