Twenty Fourteen: rename transient `all_the_cool_cats` and make sure count is an integer before checking it. Props SergeyBiryukov for initial patch, fixes #26319.
git-svn-id: https://develop.svn.wordpress.org/trunk@26572 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
f38ae9cc6c
commit
5d48726d03
|
@ -129,7 +129,7 @@ endif;
|
|||
* @return boolean true if blog has more than 1 category
|
||||
*/
|
||||
function twentyfourteen_categorized_blog() {
|
||||
if ( false === ( $all_the_cool_cats = get_transient( 'all_the_cool_cats' ) ) ) {
|
||||
if ( false === ( $all_the_cool_cats = get_transient( 'twentyfourteen_category_count' ) ) ) {
|
||||
// Create an array of all the categories that are attached to posts
|
||||
$all_the_cool_cats = get_categories( array(
|
||||
'hide_empty' => 1,
|
||||
|
@ -138,10 +138,10 @@ function twentyfourteen_categorized_blog() {
|
|||
// Count the number of categories that are attached to the posts
|
||||
$all_the_cool_cats = count( $all_the_cool_cats );
|
||||
|
||||
set_transient( 'all_the_cool_cats', $all_the_cool_cats );
|
||||
set_transient( 'twentyfourteen_category_count', $all_the_cool_cats );
|
||||
}
|
||||
|
||||
if ( '1' != $all_the_cool_cats ) {
|
||||
if ( 1 !== (int) $all_the_cool_cats ) {
|
||||
// This blog has more than 1 category so twentyfourteen_categorized_blog should return true
|
||||
return true;
|
||||
} else {
|
||||
|
@ -159,7 +159,7 @@ function twentyfourteen_categorized_blog() {
|
|||
*/
|
||||
function twentyfourteen_category_transient_flusher() {
|
||||
// Like, beat it. Dig?
|
||||
delete_transient( 'all_the_cool_cats' );
|
||||
delete_transient( 'twentyfourteen_category_count' );
|
||||
}
|
||||
add_action( 'edit_category', 'twentyfourteen_category_transient_flusher' );
|
||||
add_action( 'save_post', 'twentyfourteen_category_transient_flusher' );
|
||||
|
|
Loading…
Reference in New Issue