• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Show Specific Taxonomy Types in Genesis Entry Footer / Post Meta / Post Terms

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Show Specific Taxonomy Types in Genesis Entry Footer / Post Meta / Post Terms

This topic is: not resolved

Tagged: get terms, is_tax, post terms, taxonomy type

  • This topic has 6 replies, 2 voices, and was last updated 8 years, 8 months ago by SeoGreenPea.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • March 20, 2017 at 4:58 am #203435
    SeoGreenPea
    Member

    I have a custom post type "Books" with a taxonomy type "book-type".

    Within my "book-type" taxonomy, I have multiple child taxonomy types.

    Here's an example of how I have things structured...

    Books - (cpt)
    Fictional Books (taxonomy)
    -Scary (child taxonomy type of "Fictional Books")
    --Reading Level 1 (child taxonomy type of "Scary")
    --Reading Level 2 (child taxonomy type of "Scary")
    --Reading Level 3 (child taxonomy type of "Scary")
    --Ages 5-10 (child taxonomy type of "Scary")
    --Ages 10-15 (child taxonomy type of "Scary")

    Let's assume I created a new "Books" CPT...

    Title: 5 Scary Creepy Crawling Insects

    Let's assume I have attached the following taxonomy types to it...

    Scary
    Reading Level 2
    Ages 5-10

    I only want the "Scary" (child taxonomy type of "Fictional Books") & the "Reading Level 2" (child taxonomy type of "Scary"), while EXCLUDING "Ages 5-10" from showing in the post meta / post terms on the front end. I'm keeping the "Ages 5-10" attached for the book to show up within my "Ages 5-10" archives.

    Here's the code I'm currently using.

    //* Display Entry Footer Category & Taxonomy Post Meta
    add_filter( 'genesis_post_meta', 'custom_post_meta_filter' );
    function custom_post_meta_filter($post_meta) {
    	if ('book' == get_post_type() || is_tax( 'book-type' ) ) {
    	$post_meta = '[post_terms taxonomy="book-type" before="Type Of Book: "]';
    	return $post_meta;
    	}
    	
    	elseif ( is_singular ) {
    	$post_meta = '[post_categories before="Filed Under: "]';
    	return $post_meta;
    	}
    }

    This works as it should by displaying all types on the front end...
    Type Of Book: Scary, Reading Level 2, Ages 5-10

    But I only want it to show...
    Type Of Book: Scary, Reading Level 2

    Is there a way to only include the taxonomy types by "id"?
    Instead of...
    [post_terms taxonomy="book-type" before="Type Of Book: "]
    Maybe something like?...
    [post_terms tax_id=(array(5,12,9) before="Type Of Book: "]

    Anyone out there smart enough or have any ideas on how to go about this using Genesis?

    March 20, 2017 at 6:57 am #203441
    Brad Dalton
    Participant

    How about using the 2nd parameter for is_tax which is terms?


    Tutorials for StudioPress Themes.

    March 20, 2017 at 7:21 am #203446
    SeoGreenPea
    Member

    I guess I'm not quite following you, but I appreciate your time in suggesting.

    Still looking for a solution.

    Thanks.

    March 20, 2017 at 7:31 am #203449
    Brad Dalton
    Participant

    Your shortcode uses get_the_term_list which doesn't enable you to exclude terms.

    So you may need to filter it using genesis_post_terms_shortcode and use a more flexible function like get_terms which enables you to include or exclude terms.


    Tutorials for StudioPress Themes.

    March 20, 2017 at 7:57 am #203452
    SeoGreenPea
    Member

    Thank you, I'll have to look into "filter it using genesis_post_terms_shortcode" which I'm not familiar with.

    I thought I'd offer up another solution I'm considering trying out.

    Each of my taxonomies have a custom field value that I'm using to output throughout the site elsewhere and for markup purposes.

    I thought I might skip the entire...

    if ('book' == get_post_type() || is_tax( 'book-type' ) ) {
    $post_meta = '[post_terms taxonomy="book-type" before="Type Of Book: "]';
    return $post_meta;
    }

    and just use a function similar to...

    add_action('genesis_entry_footer', 'custom_post_meta_filter');
    function custom_post_meta_filter() {
    if ('book' == get_post_type() || is_tax( 'book-type' ) ) && genesis_get_custom_field('book_tax_type_name_scary') ) && genesis_get_custom_field('book_tax_type_name_reading_level_one') )
    echo '<p class="entry-meta">Type Of Book: '. genesis_get_custom_field('book_tax_type_name_scary') .', '. genesis_get_custom_field('book_tax_type_name_reading_level_one') .'</p>';
    }

    But then because I'm using approximately 100 different taxonomy types that all have approximately 10-15 child taxonomy types, I'd end up writing a ton of functions. Assuming my above example would even work. The additional problem with the above code is that I wouldn't have the permalink attached to the custom field, which is also another obstacle.

    I'm sure I can learn how to include the permalink, but I'll have to see if the code above even accomplishes what I'm after.

    Using the genesis_post_terms_shortcode sure sounds easier and more efficient though.

    Thanks for your input!

    March 20, 2017 at 8:09 am #203455
    Brad Dalton
    Participant

    hahaha, Thats exactly what i did here as it was so much easier to work with.

    Didn't test your code but it looks like a easy solution.


    Tutorials for StudioPress Themes.

    March 20, 2017 at 9:15 am #203471
    SeoGreenPea
    Member

    I appreciate you providing your input, referenced options and examples.

    I'll still need to probably figure out how to create my own custom genesis post terms shortcode using the get_terms method so I can select a specific taxonomy and exclude the others that are attached to my custom post type. Because I have tons of taxonomies and child taxonomies, my code above might not be efficient, even if I did figure out how to attach a permalink to a custom field.

    Thank you.

    I'm still looking for a solution that will work for my issue.

  • Author
    Posts
Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble