WordPress.org

Make WordPress Core

Ticket #21479: 21479.3.patch

File 21479.3.patch, 1.1 KB (added by lancewillett, 5 years ago)

Simpler check and correct logic for 0 or 1 category existing

  • wp-content/themes/twentytwelve/functions.php

     
    316316        // Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name. 
    317317        if ( '' != $tag_list ) { 
    318318                $utility_text = __( 'This entry was posted in %1$s and tagged %2$s on %3$s by %4$s.', 'twentytwelve' ); 
    319         } elseif ( ! empty( $categories_list ) && twentytwelve_is_categorized_site() ) { 
     319        } elseif ( $categories_list && twentytwelve_is_categorized_site() ) { 
    320320                $utility_text = __( 'This entry was posted in %1$s on %3$s by %4$s.', 'twentytwelve' ); 
    321321        } else { 
    322322                $utility_text = __( 'This entry was posted on %3$s by %4$s.', 'twentytwelve' ); 
     
    343343                'hide_empty' => 1, 
    344344        ) ); 
    345345 
    346         if ( is_wp_error( $non_empty_categories ) || empty( $non_empty_categories ) || count( $non_empty_categories ) < 1 ) 
     346        if ( is_wp_error( $non_empty_categories ) || empty( $non_empty_categories ) || count( $non_empty_categories ) < 2 ) 
    347347                return false; 
    348348 
    349349        return true;