• 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

Display post meta differently on home page

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 › Display post meta differently on home page

This topic is: not resolved

Tagged: meta, targeting

  • This topic has 9 replies, 2 voices, and was last updated 9 years, 11 months ago by donmcleman.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • July 29, 2015 at 7:52 am #160852
    donmcleman
    Member

    Hi, on the home page and archive pages I want to display post meta after the entry footer (and not display the entry header), whereas on the post I want to display it in the entry header (and not display the entry footer).

    At the moment my hack is to display both and 'display:none' one of them using css.

    I know there must be some beautiful php code that says something like 'if !home then call the header meta'... but my attempts don't work 🙂

    Please can someone help?

    http://staging.crosswebideas.com
    July 29, 2015 at 9:13 am #160857
    Brad Dalton
    Participant

    Try this http://my.studiopress.com/snippets/entry-header/

    Add the is_home() conditional after the function and change hooks if needed


    Tutorials for StudioPress Themes.

    July 29, 2015 at 10:32 am #160874
    donmcleman
    Member

    Thank you, Brad! This is the code I've used and it works:

    //* Customize the entry meta in the entry header (requires HTML5 theme support)
    add_filter( 'genesis_post_info', 'sp_post_info_filter' );
    function sp_post_info_filter($post_info) {
    	$post_info = '[post_date]';
    if( !is_home() )
    	return $post_info;
    }
    
    //* Customize the entry meta in the entry footer (requires HTML5 theme support)
    add_filter( 'genesis_post_meta', 'sp_post_meta_filter' );
    function sp_post_meta_filter($post_meta) {
    	$post_meta = '[post_date]';
    	if( is_home() )
    return $post_meta;
    }
    

    I'd also like to remove the footer mark-up on the post as I've given it a border. I thought the following code would work but it doesn't – my php skills are minimal so I can't see what's wrong:

    //* Remove the entry footer markup (requires HTML5 theme support)
    add_filter( 'genesis_entry_footer', 'crosswebideas_footer_markup');
    function crosswebideas_footer_markup() {
    if( !is_home() )
    remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 );
    remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 );
    }
    

    Please do you have any suggestions for this part?

    July 29, 2015 at 10:42 am #160876
    Brad Dalton
    Participant

    Conditional tags should come immediately after the function.

    Please start a new topic for your question relating to the footer markup.


    Tutorials for StudioPress Themes.

    July 29, 2015 at 10:48 am #160877
    donmcleman
    Member

    Sorry, Brad, I didn't know what this means: 'Conditional tags should come immediately after the function.' You can't mean after the closing curly bracket?

    July 29, 2015 at 11:46 am #160885
    Brad Dalton
    Participant

    Here's how you should use them:

     
    add_filter( 'genesis_post_meta', 'sp_post_meta_filter' );
    function sp_post_meta_filter($post_meta) {
    if( is_home() )
    $post_meta = '[post_date]';
    return $post_meta;
    }
    

    Tutorials for StudioPress Themes.

    July 29, 2015 at 12:32 pm #160889
    donmcleman
    Member

    Well, I would never have worked that out... I must take some sort of intro course.

    Thank you!

    July 29, 2015 at 12:44 pm #160893
    donmcleman
    Member

    Well, it doesn't actually work... I can see that format working for other functions but it's not working with this one.

    This posts both the footer meta and the header meta:

    
    add_filter( 'genesis_post_info', 'sp_post_info_filter' );
    function sp_post_info_filter($post_info) {
    if( !is_home() )
    $post_info = '[post_date]';
    return $post_info;
    }
    
    add_filter( 'genesis_post_meta', 'sp_post_meta_filter' );
    function sp_post_meta_filter($post_meta) {
    if( is_home() )
    $post_meta = '[post_date]';
    return $post_meta;
    }

    Any explanation?

    July 30, 2015 at 1:51 am #160922
    Brad Dalton
    Participant

    The position of your conditional tag is correct.

    Do you have the Genesis Simple Edits plugin activated?


    Tutorials for StudioPress Themes.

    July 30, 2015 at 1:56 am #160923
    donmcleman
    Member

    Hi, I don't have that plugin installed, I'm trying to cut down on the number of plugins I use so I'd really prefer a code solution.

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