From 5d48726d0323a62ec696a95ff591ae9a4e2a110b Mon Sep 17 00:00:00 2001 From: Lance Willett Date: Tue, 3 Dec 2013 18:23:58 +0000 Subject: [PATCH] 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 --- .../themes/twentyfourteen/inc/template-tags.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wp-content/themes/twentyfourteen/inc/template-tags.php b/src/wp-content/themes/twentyfourteen/inc/template-tags.php index 39232a8974..9c3a6aba6e 100644 --- a/src/wp-content/themes/twentyfourteen/inc/template-tags.php +++ b/src/wp-content/themes/twentyfourteen/inc/template-tags.php @@ -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' );