All code samples have been moved to a GitHub Gist.
If you’re working with custom taxonomies in WordPress, it’s nice to provide site owners the option to display term descriptions in their theme. Optional term descriptions can easily be displayed on a taxonomy archive page using the term_description()
function:
I generally use this bit of code on the archive.php
or taxonomy.php
templates in a theme, but it can be used on other templates as well. Check out the WordPress template hierarchy for more information on the built-in taxonomy templates that can be leveraged within a WordPress theme.
If you’re looking to use this method with categories or tags, you may want to check out the tag_description()
and category_description()
functions.