Make WordPress Core

Changeset 26572


Ignore:
Timestamp:
12/03/2013 06:23:58 PM (12 years ago)
Author:
lancewillett
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyfourteen/inc/template-tags.php

    r26556 r26572  
    130130 */
    131131function twentyfourteen_categorized_blog() {
    132     if ( false === ( $all_the_cool_cats = get_transient( 'all_the_cool_cats' ) ) ) {
     132    if ( false === ( $all_the_cool_cats = get_transient( 'twentyfourteen_category_count' ) ) ) {
    133133        // Create an array of all the categories that are attached to posts
    134134        $all_the_cool_cats = get_categories( array(
     
    139139        $all_the_cool_cats = count( $all_the_cool_cats );
    140140
    141         set_transient( 'all_the_cool_cats', $all_the_cool_cats );
    142     }
    143 
    144     if ( '1' != $all_the_cool_cats ) {
     141        set_transient( 'twentyfourteen_category_count', $all_the_cool_cats );
     142    }
     143
     144    if ( 1 !== (int) $all_the_cool_cats ) {
    145145        // This blog has more than 1 category so twentyfourteen_categorized_blog should return true
    146146        return true;
     
    160160function twentyfourteen_category_transient_flusher() {
    161161    // Like, beat it. Dig?
    162     delete_transient( 'all_the_cool_cats' );
     162    delete_transient( 'twentyfourteen_category_count' );
    163163}
    164164add_action( 'edit_category', 'twentyfourteen_category_transient_flusher' );
Note: See TracChangeset for help on using the changeset viewer.