From 87ca7b66add7936f59007a057490940cd7d81fa4 Mon Sep 17 00:00:00 2001 From: Konstantin Kovshenin Date: Tue, 18 Mar 2014 18:43:00 +0400 Subject: [PATCH] Prefix transient. --- inc/template-tags.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/inc/template-tags.php b/inc/template-tags.php index c852eb79..7ef81925 100644 --- a/inc/template-tags.php +++ b/inc/template-tags.php @@ -99,19 +99,19 @@ endif; * Returns true if a blog has more than 1 category. */ function _s_categorized_blog() { - if ( false === ( $all_the_cool_cats = get_transient( 'all_the_cool_cats' ) ) ) { + if ( false === ( $categories = get_transient( '_s_categories' ) ) ) { // Create an array of all the categories that are attached to posts. - $all_the_cool_cats = get_categories( array( + $categories = get_categories( array( 'hide_empty' => 1, ) ); // Count the number of categories that are attached to the posts. - $all_the_cool_cats = count( $all_the_cool_cats ); + $categories = count( $categories ); - set_transient( 'all_the_cool_cats', $all_the_cool_cats ); + set_transient( '_s_categories', $categories ); } - if ( '1' != $all_the_cool_cats ) { + if ( '1' != $categories ) { // This blog has more than 1 category so _s_categorized_blog should return true. return true; } else { @@ -125,7 +125,7 @@ function _s_categorized_blog() { */ function _s_category_transient_flusher() { // Like, beat it. Dig? - delete_transient( 'all_the_cool_cats' ); + delete_transient( '_s_categories' ); } add_action( 'edit_category', '_s_category_transient_flusher' ); add_action( 'save_post', '_s_category_transient_flusher' );