WordPress.org

Make WordPress Core

Changeset 14660


Ignore:
Timestamp:
05/15/10 09:59:15 (5 years ago)
Author:
markjaquith
Message:

Do not show dummy default category output when calling the_category on a post_type that does not support the category taxonomy (like pages). Fix TwentyTen theme to not display wrapping text if there are no categories. fixes #10333

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentyten/loop.php

    r14552 r14660  
    113113 
    114114            <div class="entry-utility"> 
    115                 <span class="cat-links"> 
    116                     <span class="entry-utility-prep entry-utility-prep-cat-links"> 
    117                     <?php 
    118                         printf( __('Posted in %s', 'twentyten' ), '</span> '.get_the_category_list( ', ' ) ); 
    119                     ?>                   
    120                 </span> 
    121                 <span class="meta-sep">|</span> 
     115                <?php if ( count( get_the_category() ) ) : ?> 
     116                    <span class="cat-links"> 
     117                        <span class="entry-utility-prep entry-utility-prep-cat-links"><?php printf( __('Posted in %s', 'twentyten' ), '</span> '.get_the_category_list( ', ' ) ); ?> 
     118                    </span> 
     119                    <span class="meta-sep">|</span> 
     120                <?php endif; ?> 
    122121                <?php 
    123122                    $tags_list = get_the_tag_list( '', ', ' ); 
  • trunk/wp-includes/category-template.php

    r14404 r14660  
    176176    global $wp_rewrite; 
    177177    $categories = get_the_category( $post_id ); 
     178    if ( !is_object_in_taxonomy( get_post_type( $post_id ), 'category' ) ) 
     179        return apply_filters( 'the_category', '', $separator, $parents ); 
     180 
    178181    if ( empty( $categories ) ) 
    179182        return apply_filters( 'the_category', __( 'Uncategorized' ), $separator, $parents ); 
Note: See TracChangeset for help on using the changeset viewer.