Bundled Themes: Allow category display in post preview even when only one category

The category is not shown in the preview. And because of how `themename_categorized_blog()` function in each theme returns false for 1 or fewer categories,  and in this case it won't show the new category.

The patch uses `is_preview()` to fix that in Twenty Fourteen, Fifteen and Seventeen.

Props lancewillett.

Fixes #39531.

Built from https://develop.svn.wordpress.org/trunk@40023


git-svn-id: http://core.svn.wordpress.org/trunk@39960 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
David A. Kennedy 2017-01-27 22:09:42 +00:00
parent bccec366ca
commit ca0274c2ce
4 changed files with 8 additions and 3 deletions

View File

@ -150,7 +150,7 @@ function twentyfifteen_categorized_blog() {
set_transient( 'twentyfifteen_categories', $all_the_cool_cats );
}
if ( $all_the_cool_cats > 1 ) {
if ( $all_the_cool_cats > 1 || is_preview() ) {
// This blog has more than 1 category so twentyfifteen_categorized_blog should return true.
return true;
} else {

View File

@ -140,7 +140,7 @@ function twentyfourteen_categorized_blog() {
set_transient( 'twentyfourteen_category_count', $all_the_cool_cats );
}
if ( 1 !== (int) $all_the_cool_cats ) {
if ( $all_the_cool_cats > 1 || is_preview() ) {
// This blog has more than 1 category so twentyfourteen_categorized_blog should return true
return true;
} else {

View File

@ -177,6 +177,11 @@ function twentyseventeen_categorized_blog() {
set_transient( 'twentyseventeen_categories', $category_count );
}
// Allow viewing case of 0 or 1 categories in post preview.
if ( is_preview() ) {
return true;
}
return $category_count > 1;
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.8-alpha-40022';
$wp_version = '4.8-alpha-40023';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.