Skip to content

Instantly share code, notes, and snippets.

@mfields
Created October 25, 2012 08:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfields/3951401 to your computer and use it in GitHub Desktop.
Save mfields/3951401 to your computer and use it in GitHub Desktop.
WordPress: Echoing categories and tags independent of post_type.
<?php
if ( is_object_in_taxonomy( get_post_type(), 'post_tag' ) ) {
/* translators: used between list items, there is a space after the comma. */
$tag_list = get_the_tag_list( '', __( ', ', '_s' ) );
if ( $tag_list && _s_categorized_blog() )
echo '<span class="entry-tags">' . $tag_list . '</span>';
}
if ( is_object_in_taxonomy( get_post_type(), 'category' ) ) {
/* translators: used between list items, there is a space after the comma. */
$category_list = get_the_category_list( __( ', ', '_s' ) );
if ( $category_list && _s_categorized_blog() )
echo '<span class="entry-categories">' . $category_list . '</span>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment