Display custom taxonomy output within posts
-
I am using custom taxonomies that I created manually. I can make the list of taxonomies and terms appear above or bellow a post but not in it. I am playing with the idea of using shortcodes to add the tax terms within the post but I am not sure how to go about it. For example, adding [taxonomy] to the middle of a post and having all the post’s tax info appear right there!
Currently, my tax info is displayed like so:
<dl class="my-stats"> <?php $terms_as_text = get_the_term_list( $post->ID, 'gender', '<dt>Gender: </dt><dd>', ', ', '</dd>' ) ; echo strip_tags($terms_as_text, '<dt>,<dd>, '); $terms_as_text = get_the_term_list( $post->ID, 'age', '<dt>Age: </dt><dd>', ', ', '</dd>' ) ; echo strip_tags($terms_as_text, '<dt>,<dd>, '); the_terms( $post->ID, 'location', '<dt>Loc: </dt><dd>', ', ', '</dd>' ); $terms_as_text = get_the_term_list( $post->ID, 'status', '<dt>Status: </dt><dd>', ', ', '</dd>' ) ; echo strip_tags($terms_as_text, '<dt>,<dd>, '); the_terms( $post->ID, 'contact', '<dt>Contact: </dt><dd>', ' or ', '</dd>' ); ?> </dl> <?php the_content(); ?>
Viewing 11 replies - 1 through 11 (of 11 total)
Viewing 11 replies - 1 through 11 (of 11 total)
- The topic ‘Display custom taxonomy output within posts’ is closed to new replies.