• 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

Filter post_meta in custom post types

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 › Filter post_meta in custom post types

This topic is: not resolved

Tagged: post_meta custom_post_types

  • This topic has 1 reply, 2 voices, and was last updated 12 years, 3 months ago by Aaron Eaton.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • October 8, 2013 at 3:14 am #65811
    capiedge
    Member

    I have various Custom Post types declared, and I want to display as post meta information:
    - in normal post: "filed under: category1, category2..."
    - in the custom post type: "filed under: term1, term2..."

    The code copied below, works perfect for normal posts, but in custom posts it repeats two times the "Filed under:", the first one is empty, and the second one with the terms.

    add_filter( 'genesis_post_meta', 'post_meta_filter' );
    function post_meta_filter($post_meta) {
    	if ( !is_page() ) {
    		$post_meta = '	[post_categories before="Filed Under: "]
    						[post_tags before="Tagged: "]
    						[post_terms taxonomy="agenda" before="Filed under: "]
    		';
    	return $post_meta;
    		}
    }

    How could I get only the second "Filed under" for custom post types?
    Any conditional order to specify that if categories is empty, don't show its field?
    Thank you!

    November 17, 2013 at 1:29 pm #73674
    Aaron Eaton
    Member

    You'll probably need a couple of conditionals to target the elements you need to properly show "Filed Under:".

    is_singular()

    is_post_type_archive()

    For conditionally showing the categories text:

    has_category()


    —
    J. Aaron Eaton – WordPress Consultant
    Website

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 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