• 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

Adding custom taxonomy to archive page post meta

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 › Design Tips and Tricks › Adding custom taxonomy to archive page post meta

This topic is: resolved

Tagged: add_filter, Custom Post Type, custom taxonomy, is_page_template, post meta, post_meta

  • This topic has 2 replies, 1 voice, and was last updated 13 years, 5 months ago by FireSamurai.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • January 17, 2013 at 11:33 am #12657
    FireSamurai
    Member

    Is anyone aware how to display a custom post type's (cpt) taxonomy on an `archive-[cpt].php` page? I've tried numerous different things, but have come up short. The closest I can get to this is by filter the post meta, however, `is_page_template()` is not allowed within the loop...

    Here is the filter method that works with the exception of the `is_page_template` conditional tag.

    /** Customize the post meta function for archive-news.php */
    add_filter( 'genesis_post_meta', 'post_meta_filter' );
    function post_meta_filter( $post_meta ) {
    if ( is_page_template( 'archive-news.php' ) ) {
        $news_taxonomy = get_the_term_list( $post->ID, 'news_category', 'Filed Under: ', ', ', '' );
    	$post_meta = $news_taxonomy . '[post_tags before="Tagged: "]';
        return $post_meta;
    }}
    
    January 17, 2013 at 12:57 pm #12683
    FireSamurai
    Member

    I have also attempted moving the conditional out of the filter function in this way, but with no luck:

    /** Customize the post meta function for archive-news.php */
    function change_news_post_meta_filter() {
    	if ( is_page_template( 'archive-news.php' ) ) {
    		
    		add_filter( 'genesis_post_meta', 'news_post_meta_filter' );
    		function news_post_meta_filter( $post_meta ) {
    			
    			$news_taxonomy = get_the_term_list( $post->ID, 'news_category', 'Blah Under: ', ', ', '' );
    			$post_meta = $news_taxonomy . '[post_tags before="Tagged: "]';
    			
    			return $post_meta;
    		}
    	}
    }
    
    January 17, 2013 at 1:41 pm #12701
    FireSamurai
    Member

    Okay... feeling a little totally embarrassed here. It turns out after many attempts that I was in the wrong file; no wonder nothing I attempted worked. *facepalm*

    When I realized that, I went back to an earlier (and simpler) version and it's working just fine. The following code will display the CPT's categories on any page using `archive-[cpt].php` page template. Add this to your `archive-[cpt].php` page template. You will need to replace 'news_category' with whatever you used when registering your taxonomy.

    add_filter( 'genesis_post_meta', 'news_post_meta_filter' );
    function news_post_meta_filter( $post_meta ) {
    	
    	$news_taxonomy = get_the_term_list( $post->ID, 'news_category', 'Filed Under: ', ', ', '' );
    	$post_meta = $news_taxonomy . '[post_tags before="Tagged: "]';
    	
    	return $post_meta;
    }
    
  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Design Tips and Tricks’ 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

© 2026 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