forked from mirror/_s
commit
74e9b10a7a
|
@ -99,7 +99,7 @@ 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',
|
||||||
|
@ -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' );
|
||||||
|
|
Reference in New Issue