feat: Twenty Sixteen 主题,带定制 Header 布局 + mu-plugins
This commit is contained in:
91
twentysixteen/inc/back-compat.php
Normal file
91
twentysixteen/inc/back-compat.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/**
|
||||
* Twenty Sixteen back compat functionality
|
||||
*
|
||||
* Prevents Twenty Sixteen from running on WordPress versions prior to 4.4,
|
||||
* since this theme is not meant to be backward compatible beyond that and
|
||||
* relies on many newer functions and markup changes introduced in 4.4.
|
||||
*
|
||||
* @package WordPress
|
||||
* @subpackage Twenty_Sixteen
|
||||
* @since Twenty Sixteen 1.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Prevents switching to Twenty Sixteen on old versions of WordPress.
|
||||
*
|
||||
* Switches to the default theme.
|
||||
*
|
||||
* @since Twenty Sixteen 1.0
|
||||
*/
|
||||
function twentysixteen_switch_theme() {
|
||||
switch_theme( WP_DEFAULT_THEME, WP_DEFAULT_THEME );
|
||||
|
||||
unset( $_GET['activated'] );
|
||||
|
||||
add_action( 'admin_notices', 'twentysixteen_upgrade_notice' );
|
||||
}
|
||||
add_action( 'after_switch_theme', 'twentysixteen_switch_theme' );
|
||||
|
||||
/**
|
||||
* Adds a message for unsuccessful theme switch.
|
||||
*
|
||||
* Prints an update nag after an unsuccessful attempt to switch to
|
||||
* Twenty Sixteen on WordPress versions prior to 4.4.
|
||||
*
|
||||
* @since Twenty Sixteen 1.0
|
||||
*
|
||||
* @global string $wp_version WordPress version.
|
||||
*/
|
||||
function twentysixteen_upgrade_notice() {
|
||||
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']
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevents the Customizer from being loaded on WordPress versions prior to 4.4.
|
||||
*
|
||||
* @since Twenty Sixteen 1.0
|
||||
*
|
||||
* @global string $wp_version WordPress version.
|
||||
*/
|
||||
function twentysixteen_customize() {
|
||||
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']
|
||||
),
|
||||
'',
|
||||
array(
|
||||
'back_link' => true,
|
||||
)
|
||||
);
|
||||
}
|
||||
add_action( 'load-customize.php', 'twentysixteen_customize' );
|
||||
|
||||
/**
|
||||
* Prevents the Theme Preview from being loaded on WordPress versions prior to 4.4.
|
||||
*
|
||||
* @since Twenty Sixteen 1.0
|
||||
*
|
||||
* @global string $wp_version WordPress version.
|
||||
*/
|
||||
function twentysixteen_preview() {
|
||||
if ( isset( $_GET['preview'] ) ) {
|
||||
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' );
|
||||
157
twentysixteen/inc/block-patterns.php
Normal file
157
twentysixteen/inc/block-patterns.php
Normal file
@@ -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', 'twentysixteen' ) . '</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 -->',
|
||||
)
|
||||
);
|
||||
}
|
||||
1267
twentysixteen/inc/customizer.php
Normal file
1267
twentysixteen/inc/customizer.php
Normal file
File diff suppressed because it is too large
Load Diff
301
twentysixteen/inc/template-tags.php
Normal file
301
twentysixteen/inc/template-tags.php
Normal file
@@ -0,0 +1,301 @@
|
||||
<?php
|
||||
/**
|
||||
* Custom Twenty Sixteen template tags
|
||||
*
|
||||
* Eventually, some of the functionality here could be replaced by core features.
|
||||
*
|
||||
* @package WordPress
|
||||
* @subpackage Twenty_Sixteen
|
||||
* @since Twenty Sixteen 1.0
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'twentysixteen_entry_meta' ) ) :
|
||||
/**
|
||||
* Prints HTML with meta information for the categories, tags.
|
||||
*
|
||||
* Create your own twentysixteen_entry_meta() function to override in a child theme.
|
||||
*
|
||||
* @since Twenty Sixteen 1.0
|
||||
*/
|
||||
function twentysixteen_entry_meta() {
|
||||
if ( 'post' === get_post_type() ) {
|
||||
/**
|
||||
* Filters the Twenty Sixteen entry meta avatar size.
|
||||
*
|
||||
* @since Twenty Sixteen 1.0
|
||||
*
|
||||
* @param int $size The avatar height and width size in pixels.
|
||||
*/
|
||||
$author_avatar_size = apply_filters( 'twentysixteen_author_avatar_size', 49 );
|
||||
printf(
|
||||
'<span class="byline">%1$s<span class="screen-reader-text">%2$s </span><span class="author vcard"><a class="url fn n" href="%3$s">%4$s</a></span></span>',
|
||||
get_avatar( get_the_author_meta( 'user_email' ), $author_avatar_size ),
|
||||
/* translators: Hidden accessibility text. */
|
||||
_x( 'Author', 'Used before post author name.', 'twentysixteen' ),
|
||||
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
|
||||
get_the_author()
|
||||
);
|
||||
}
|
||||
|
||||
if ( in_array( get_post_type(), array( 'post', 'attachment' ), true ) ) {
|
||||
twentysixteen_entry_date();
|
||||
}
|
||||
|
||||
$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>',
|
||||
/* translators: Hidden accessibility text. */
|
||||
_x( 'Format', 'Used before post format.', 'twentysixteen' )
|
||||
),
|
||||
esc_url( get_post_format_link( $format ) ),
|
||||
get_post_format_string( $format )
|
||||
);
|
||||
}
|
||||
|
||||
if ( 'post' === get_post_type() ) {
|
||||
twentysixteen_entry_taxonomies();
|
||||
}
|
||||
|
||||
if ( ! is_singular() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
|
||||
echo '<span class="comments-link">';
|
||||
/* translators: %s: Post title. Only visible to screen readers. */
|
||||
comments_popup_link( sprintf( __( 'Leave a comment<span class="screen-reader-text"> on %s</span>', 'twentysixteen' ), get_the_title() ) );
|
||||
echo '</span>';
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'twentysixteen_entry_date' ) ) :
|
||||
/**
|
||||
* Prints HTML with date information for current post.
|
||||
*
|
||||
* Create your own twentysixteen_entry_date() function to override in a child theme.
|
||||
*
|
||||
* @since Twenty Sixteen 1.0
|
||||
*/
|
||||
function twentysixteen_entry_date() {
|
||||
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
|
||||
|
||||
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>';
|
||||
}
|
||||
|
||||
$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()
|
||||
);
|
||||
|
||||
printf(
|
||||
'<span class="posted-on"><span class="screen-reader-text">%1$s </span><a href="%2$s" rel="bookmark">%3$s</a></span>',
|
||||
/* translators: Hidden accessibility text. */
|
||||
_x( 'Posted on', 'Used before publish date.', 'twentysixteen' ),
|
||||
esc_url( get_permalink() ),
|
||||
$time_string
|
||||
);
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'twentysixteen_entry_taxonomies' ) ) :
|
||||
/**
|
||||
* Prints HTML with category and tags for current post.
|
||||
*
|
||||
* Create your own twentysixteen_entry_taxonomies() function to override in a child theme.
|
||||
*
|
||||
* @since Twenty Sixteen 1.0
|
||||
*/
|
||||
function twentysixteen_entry_taxonomies() {
|
||||
$categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentysixteen' ) );
|
||||
if ( $categories_list && twentysixteen_categorized_blog() ) {
|
||||
printf(
|
||||
'<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',
|
||||
/* translators: Hidden accessibility text. */
|
||||
_x( 'Categories', 'Used before category names.', 'twentysixteen' ),
|
||||
$categories_list
|
||||
);
|
||||
}
|
||||
|
||||
$tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'twentysixteen' ) );
|
||||
if ( $tags_list && ! is_wp_error( $tags_list ) ) {
|
||||
printf(
|
||||
'<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',
|
||||
/* translators: Hidden accessibility text. */
|
||||
_x( 'Tags', 'Used before tag names.', 'twentysixteen' ),
|
||||
$tags_list
|
||||
);
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'twentysixteen_post_thumbnail' ) ) :
|
||||
/**
|
||||
* Displays an optional post thumbnail.
|
||||
*
|
||||
* Wraps the post thumbnail in an anchor element on index views, or a div
|
||||
* element when on single views.
|
||||
*
|
||||
* Create your own twentysixteen_post_thumbnail() function to override in a child theme.
|
||||
*
|
||||
* @since Twenty Sixteen 1.0
|
||||
*/
|
||||
function twentysixteen_post_thumbnail() {
|
||||
if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( is_singular() ) :
|
||||
?>
|
||||
|
||||
<div class="post-thumbnail">
|
||||
<?php the_post_thumbnail(); ?>
|
||||
</div><!-- .post-thumbnail -->
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<a class="post-thumbnail" href="<?php the_permalink(); ?>" aria-hidden="true">
|
||||
<?php the_post_thumbnail( 'post-thumbnail', array( 'alt' => the_title_attribute( 'echo=0' ) ) ); ?>
|
||||
</a>
|
||||
|
||||
<?php
|
||||
endif; // End is_singular().
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'twentysixteen_excerpt' ) ) :
|
||||
/**
|
||||
* Displays the optional excerpt.
|
||||
*
|
||||
* Wraps the excerpt in a div element.
|
||||
*
|
||||
* Create your own twentysixteen_excerpt() function to override in a child theme.
|
||||
*
|
||||
* @since Twenty Sixteen 1.0
|
||||
*
|
||||
* @param string $css_class Optional. Class string of the div element. Defaults to 'entry-summary'.
|
||||
*/
|
||||
function twentysixteen_excerpt( $css_class = 'entry-summary' ) {
|
||||
$css_class = esc_attr( $css_class );
|
||||
|
||||
if ( has_excerpt() || is_search() ) :
|
||||
?>
|
||||
<div class="<?php echo $css_class; ?>">
|
||||
<?php the_excerpt(); ?>
|
||||
</div><!-- .<?php echo $css_class; ?> -->
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'twentysixteen_excerpt_more' ) && ! is_admin() ) :
|
||||
/**
|
||||
* Replaces "[...]" (appended to automatically generated excerpts) with ... and
|
||||
* a 'Continue reading' link.
|
||||
*
|
||||
* Create your own twentysixteen_excerpt_more() function to override in a child theme.
|
||||
*
|
||||
* @since Twenty Sixteen 1.0
|
||||
*
|
||||
* @return string 'Continue reading' link prepended with an ellipsis.
|
||||
*/
|
||||
function twentysixteen_excerpt_more() {
|
||||
$link = sprintf(
|
||||
'<a href="%1$s" class="more-link">%2$s</a>',
|
||||
esc_url( get_permalink( get_the_ID() ) ),
|
||||
/* translators: %s: Post title. Only visible to screen readers. */
|
||||
sprintf( __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentysixteen' ), get_the_title( get_the_ID() ) )
|
||||
);
|
||||
return ' … ' . $link;
|
||||
}
|
||||
add_filter( 'excerpt_more', 'twentysixteen_excerpt_more' );
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'twentysixteen_categorized_blog' ) ) :
|
||||
/**
|
||||
* Determines whether blog/site has more than one category.
|
||||
*
|
||||
* Create your own twentysixteen_categorized_blog() function to override in a child theme.
|
||||
*
|
||||
* @since Twenty Sixteen 1.0
|
||||
*
|
||||
* @return bool True if there is more than one category, false otherwise.
|
||||
*/
|
||||
function twentysixteen_categorized_blog() {
|
||||
$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(
|
||||
'fields' => 'ids',
|
||||
// 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 );
|
||||
|
||||
set_transient( 'twentysixteen_categories', $all_the_cool_cats );
|
||||
}
|
||||
|
||||
if ( $all_the_cool_cats > 1 || is_preview() ) {
|
||||
// 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.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
/**
|
||||
* Flushes out the transients used in twentysixteen_categorized_blog().
|
||||
*
|
||||
* @since Twenty Sixteen 1.0
|
||||
*/
|
||||
function twentysixteen_category_transient_flusher() {
|
||||
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
|
||||
return;
|
||||
}
|
||||
// Like, beat it. Dig?
|
||||
delete_transient( 'twentysixteen_categories' );
|
||||
}
|
||||
add_action( 'edit_category', 'twentysixteen_category_transient_flusher' );
|
||||
add_action( 'save_post', 'twentysixteen_category_transient_flusher' );
|
||||
|
||||
if ( ! function_exists( 'twentysixteen_the_custom_logo' ) ) :
|
||||
/**
|
||||
* Displays the optional custom logo.
|
||||
*
|
||||
* Does nothing if the custom logo is not available.
|
||||
*
|
||||
* @since Twenty Sixteen 1.2
|
||||
*/
|
||||
function twentysixteen_the_custom_logo() {
|
||||
if ( function_exists( 'the_custom_logo' ) ) {
|
||||
the_custom_logo();
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'wp_body_open' ) ) :
|
||||
/**
|
||||
* Fires the wp_body_open action.
|
||||
*
|
||||
* Added for backward compatibility to support pre-5.2.0 WordPress versions.
|
||||
*
|
||||
* @since Twenty Sixteen 2.0
|
||||
*/
|
||||
function wp_body_open() {
|
||||
/**
|
||||
* Triggered after the opening <body> tag.
|
||||
*
|
||||
* @since Twenty Sixteen 2.0
|
||||
*/
|
||||
do_action( 'wp_body_open' );
|
||||
}
|
||||
endif;
|
||||
Reference in New Issue
Block a user