Merge branch 'pr/437'

Conflicts:
	inc/template-tags.php
This commit is contained in:
Konstantin Obenland 2014-03-30 12:02:05 -07:00
commit 74e9b10a7a
1 changed files with 4 additions and 4 deletions

View File

@ -99,12 +99,12 @@ endif;
* Returns true if a blog has more than 1 category. * Returns true if a blog has more than 1 category.
*/ */
function _s_categorized_blog() { function _s_categorized_blog() {
if ( false === ( $all_the_cool_cats = get_transient( 'all_the_cool_cats' ) ) ) { if ( false === ( $all_the_cool_cats = get_transient( '_s_categories' ) ) ) {
// Create an array of all the categories that are attached to posts. // Create an array of all the categories that are attached to posts.
$all_the_cool_cats = get_categories( array( $all_the_cool_cats = get_categories( array(
'fields' => 'ids', 'fields' => 'ids',
'hide_empty' => 1, 'hide_empty' => 1,
// We only need to know if there is more than one category. // We only need to know if there is more than one category.
'number' => 2, 'number' => 2,
) ); ) );
@ -112,7 +112,7 @@ function _s_categorized_blog() {
// Count the number of categories that are attached to the posts. // Count the number of categories that are attached to the posts.
$all_the_cool_cats = count( $all_the_cool_cats ); $all_the_cool_cats = count( $all_the_cool_cats );
set_transient( 'all_the_cool_cats', $all_the_cool_cats ); set_transient( '_s_categories', $all_the_cool_cats );
} }
if ( $all_the_cool_cats > 1 ) { if ( $all_the_cool_cats > 1 ) {
@ -129,7 +129,7 @@ function _s_categorized_blog() {
*/ */
function _s_category_transient_flusher() { function _s_category_transient_flusher() {
// Like, beat it. Dig? // Like, beat it. Dig?
delete_transient( 'all_the_cool_cats' ); delete_transient( '_s_categories' );
} }
add_action( 'edit_category', '_s_category_transient_flusher' ); add_action( 'edit_category', '_s_category_transient_flusher' );
add_action( 'save_post', '_s_category_transient_flusher' ); add_action( 'save_post', '_s_category_transient_flusher' );