This weekend, I temporarily got stuck on a simple problem.  How to list or display Custom Taxonomies (Custom Tags or Categories) in a Genesis Child Theme on a Custom Post Type Single post.

That last sentence probably seems ridiculously filled with double speak. It is, but the specificity was needed.  I probably performed 2 dozen google searches trying to narrow things down before I found what I was looking for.  Sometimes too many keywords makes it impossible to find what you are looking for…

Here’s the code I used. Note I provided my own taxonomy which was theme_type. You can customize the text that shows up before your list of tag like links by changing the text in quotes after before= as well.

[php highlight=”3″]
add_filter( ‘genesis_post_meta’, ‘afn_display_custom_tax’ );
function afn_display_custom_tax($post_meta) {
$post_meta = ‘[post_terms taxonomy="theme_type" before="Type: "]’;
return $post_meta;
}
[/php]

After all that searching I wanted to share the site and article where I finally found my answer.

How to Display Custom Taxonomy With Genesis Framework Shortcodes

Besides hooks, Genesis Framework has lots of shortcodes to help you customize your child theme. Before this, we’ve published a tutorial on creating your first custom post type and custom taxonomy and today, we’ll show how easy it is to display the custom taxonomy on your site. Using [post_terms] Shortcode If you refer to Genesis shortcode reference page, you’ll notice a less-known [post_terms] shortcode. How to Display Custom Taxonomy With Genesis Framework Shortcodes

Need to Display Multiple Taxonomies?

[php]
//* Display multiple custom taxonomy items in the post meta

add_filter( ‘genesis_post_meta’, ‘afn_display_custom_tax’ );
function afn_display_custom_tax($post_meta) {
$post_meta = ‘[post_terms taxonomy="theme_type" before="Type of Theme: "]
[post_terms taxonomy="theme_author" before="Author: "]
[post_terms taxonomy="theme_characteristics" before="Characteristics: "]’;
return $post_meta;
}
[/php]

Want to mix in Shortcodes?

It is important to understand that [ post_terms ] is a short code for genesis. You can also add/mix in other short codes, but they will not automatically run unless you utilize do_shortcode.

short codes mixed in with post terms

Comments

Responses...