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. git-svn-id: https://develop.svn.wordpress.org/trunk@40023 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
f84ad90c1f
commit
7748800a48
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user