Skip to content

Commit

Permalink
_s: Add custom taxonomy support for term descriptions in taxonomy
Browse files Browse the repository at this point in the history
archives.

We don't even have to check for a context before printing the
description, `term_description()` does all the heavy lifting for us.

Props @jasondpx. Fixes #128.
  • Loading branch information
obenland committed Jun 27, 2013
1 parent 55596d6 commit 3a5afef
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions archive.php
Expand Up @@ -66,20 +66,10 @@
?>
</h1>
<?php
if ( is_category() ) :
// show an optional category description
$category_description = category_description();
if ( ! empty( $category_description ) ) :
echo apply_filters( 'category_archive_meta', '<div class="taxonomy-description">' . $category_description . '</div>' );
endif;

elseif ( is_tag() ) :
// show an optional tag description
$tag_description = tag_description();
if ( ! empty( $tag_description ) ) :
echo apply_filters( 'tag_archive_meta', '<div class="taxonomy-description">' . $tag_description . '</div>' );
endif;

// Show an optional term description.
$term_description = term_description();
if ( ! empty( $term_description ) ) :
printf( '<div class="taxonomy-description">%s</div>', $term_description );
endif;
?>
</header><!-- .page-header -->
Expand Down

2 comments on commit 3a5afef

@mfields
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/taxonomy-description/term-description for the class name.

@obenland
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both categories and tags had taxonomy-description, which is why I left it. But I feel indifferent about it, feel free to change it. :)

Please sign in to comment.