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
git-svn-id: http://svn.automattic.com/wordpress/trunk@14660 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
88bce6a716
commit
4ab768959d
|
@ -112,13 +112,12 @@
|
|||
<?php endif; ?>
|
||||
|
||||
<div class="entry-utility">
|
||||
<span class="cat-links">
|
||||
<span class="entry-utility-prep entry-utility-prep-cat-links">
|
||||
<?php
|
||||
printf( __('Posted in %s', 'twentyten' ), '</span> '.get_the_category_list( ', ' ) );
|
||||
?>
|
||||
</span>
|
||||
<span class="meta-sep">|</span>
|
||||
<?php if ( count( get_the_category() ) ) : ?>
|
||||
<span class="cat-links">
|
||||
<span class="entry-utility-prep entry-utility-prep-cat-links"><?php printf( __('Posted in %s', 'twentyten' ), '</span> '.get_the_category_list( ', ' ) ); ?>
|
||||
</span>
|
||||
<span class="meta-sep">|</span>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
$tags_list = get_the_tag_list( '', ', ' );
|
||||
if ( $tags_list ):
|
||||
|
|
|
@ -175,6 +175,9 @@ function get_the_category_by_ID( $cat_ID ) {
|
|||
function get_the_category_list( $separator = '', $parents='', $post_id = false ) {
|
||||
global $wp_rewrite;
|
||||
$categories = get_the_category( $post_id );
|
||||
if ( !is_object_in_taxonomy( get_post_type( $post_id ), 'category' ) )
|
||||
return apply_filters( 'the_category', '', $separator, $parents );
|
||||
|
||||
if ( empty( $categories ) )
|
||||
return apply_filters( 'the_category', __( 'Uncategorized' ), $separator, $parents );
|
||||
|
||||
|
|
Loading…
Reference in New Issue