• 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

Remove Post Meta from category pages but not posts

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 › Remove Post Meta from category pages but not posts

This topic is: resolved

Tagged: genesis sample theme, remove post info, remove post meta

  • This topic has 13 replies, 3 voices, and was last updated 8 years, 7 months ago by GokulDeepak.
Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • October 17, 2015 at 5:17 pm #168352
    nate
    Member

    Hi there

    I've been trying to figure this out for a bit now but can't quite get it from searching on google and on this forum.

    I want the post meta and post info on my blogroll and my category pages to not show up but still show up on the individual posts.

    I tried this code in Functions PHP:

    //* Remove post meta from archive pages
    remove_action('genesis_entry_footer', 'genesis_post_meta', 12);
    remove_action('genesis_entry_header', 'genesis_post_info', 12);
    
    add_action('template_redirect', 'child_conditional_actions');
    function child_conditional_actions() { if( is_single() ) {
    add_action('genesis_entry_footer', 'genesis_post_meta', 12);
    add_action('genesis_entry_header', 'genesis_post_info', 12);
    }}

    Which I found at http://blogaliving.com/genesis-how-to-place-the-post-meta-and-info-just-on-single-pages/#comment-1207

    And then I removed the second "add_action" because it was showing the post meta twice on both the cateogry pages and the individual posts.

    The result I get at the moment is that the code works for the "post info". i.e. it doesn't show on the category pages or front page but does on the individual posts.

    But the "post meta" is still showing up on both.

    Does anyone know anything to try to make this work properly. I tried several different codes but this one has me the closest - just not quite there.

    Any help is much appreciated.

    Cheers,
    Nate

    P.S: The code is currently on this site which I use to test stuff - http://testitout2.siterubix.com/

    But eventually I will put it on http://sixstringacoustic.com

    http://sixstringacoustic.com/
    October 19, 2015 at 1:23 pm #168508
    Porter
    Participant

    This should do the trick:

    // Remove Post Info, Post Meta from Archive Pages
    function themeprefix_remove_post_meta() {
    	if (is_archive()) {
    		remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
    		remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
    		}
    }
    add_action ( 'genesis_entry_header', 'themeprefix_remove_post_meta' );

    Source

    Rather than remove it, then add it back, we're simply adding a conditional check to see when we should remove it, and only removing it then.


    Buy me a beer? | Try DigitalOcean VPS Hosting

    October 27, 2015 at 2:40 pm #169247
    nate
    Member

    Hi Porter

    Thanks for this. Sorry for the late reply here. I thought I had clicked notify me of follow-ups via email but I mustn't have!

    This code has worked perfectly for category pages - i.e. they now don't show post meta or post info and do show the post meta and post info on the individual posts.

    However, the post meta and post info still show on the front page (I'm using the "your latest posts" for the front page option in wordpress writing settings). Do you know if there's a way that I can also have it so that the post meta and post info doesn't show on the front page?

    i.e. is there a condition like:

    if (is_frontpage())

    That I could add into that code to do that?

    Thanks for all your help so far. Much appreciated.

    Nate

    October 27, 2015 at 2:53 pm #169250
    Porter
    Participant

    There is exactly that function haha

    // Remove Post Info, Post Meta from Archive Pages
    function themeprefix_remove_post_meta() {
    if (is_archive() || is_front_page()) {
    remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
    remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
    }
    }
    add_action ( 'genesis_entry_header', 'themeprefix_remove_post_meta' );

    || means "or", so we're simply checking to see if it's an archive, OR the front page, and we remove them if it's either.


    Buy me a beer? | Try DigitalOcean VPS Hosting

    October 27, 2015 at 3:22 pm #169255
    nate
    Member

    Hi

    Thanks for your speedy reply!

    I added that in and the post meta and post info is still showing on the front page and it's now also showing up again on the category pages.

    This is exactly what's in my functions.php

    // Remove Post Info, Post Meta from Archive Pages
    function themeprefix_remove_post_meta() {
    if (is_archive() || is_front_page()) {
    remove_action( ‘genesis_entry_header’, ‘genesis_post_info’, 12 );
    remove_action( ‘genesis_entry_footer’, ‘genesis_post_meta’ );
    }
    }
    add_action ( ‘genesis_entry_header’, ‘themeprefix_remove_post_meta’ );

    Thanks so much for your help so far.

    October 27, 2015 at 3:25 pm #169256
    Porter
    Participant

    Hmm, I could see it showing up on the front page still, not sure why it came back on the archive pages, but moving on! Try this:

    // Remove Post Info, Post Meta from Archive Pages
    function themeprefix_remove_post_meta() {
    if (is_archive() || is_home()) {
    remove_action( ‘genesis_entry_header’, ‘genesis_post_info’, 12 );
    remove_action( ‘genesis_entry_footer’, ‘genesis_post_meta’ );
    }
    }
    add_action ( ‘genesis_entry_header’, ‘themeprefix_remove_post_meta’ );

    If that doesn't work, simply try this to see if only the front page is fixed:

    // Remove Post Info, Post Meta from Archive Pages
    function themeprefix_remove_post_meta() {

    if (is_front_page()) {
    remove_action( ‘genesis_entry_header’, ‘genesis_post_info’, 12 );
    remove_action( ‘genesis_entry_footer’, ‘genesis_post_meta’ );
    }
    }
    add_action ( ‘genesis_entry_header’, ‘themeprefix_remove_post_meta’ );

    Also try is_home in that last example if it doesn't work.


    Buy me a beer? | Try DigitalOcean VPS Hosting

    October 27, 2015 at 3:52 pm #169263
    nate
    Member

    Got it to work!

    Thanks so much. Very much appreciated.

    I first tried with just the is_front_page and that didn't work but then I used the original code you gave me and replaced the is_archive with is_front_page and that worked for the front page and then I added in the || is_archive()) and now it works for both.

    So final code, for anyone else who's having difficulty with this, was:

    // Remove Post Info, Post Meta from Archive Pages
    function themeprefix_remove_post_meta() {
    	if (is_front_page() || is_archive()) {
    		remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
    		remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
    		}
    }
    add_action ( 'genesis_entry_header', 'themeprefix_remove_post_meta' );

    Thanks Porter!

    October 27, 2015 at 3:56 pm #169266
    Porter
    Participant

    Interesting, so you're saying the order of is_archive and is_front_page mattered? To the very best of my knowledge, it shouldn't, so now I need to go make a test! Glad you got it working, good luck with the site.


    Buy me a beer? | Try DigitalOcean VPS Hosting

    October 27, 2015 at 4:01 pm #169267
    nate
    Member

    I'm not sure if the order made any difference. I think it was more copying the original code that you sent me in and adding in the || that did the trick. Maybe there was a small typo somewhere in the second lot of code. I'll give it a look.

    After looking in there the only difference I can see from the first code to the second code is that there was no indentation in parts of the second lot of code that there were in the first code you sent. I'm not sure if this indentation makes any difference?

    October 27, 2015 at 4:02 pm #169269
    Porter
    Participant

    It shouldn't matter, I personally prefer no spacing, while most php adds space. Running a test now to put my mind to rest.


    Buy me a beer? | Try DigitalOcean VPS Hosting

    October 27, 2015 at 4:16 pm #169270
    Porter
    Participant

    Just confirmed, order doesn't matter - phew, my brain almost fried haha - thought there might be some very odd logic in the is_front_page function that required it go first, which makes no sense. You must have copied something wrong or had one small change, but no worries, all is good 🙂


    Buy me a beer? | Try DigitalOcean VPS Hosting

    October 27, 2015 at 4:37 pm #169275
    nate
    Member

    Good to know.

    Yeah I must've missed something. Glad it's working now.

    One more small thing - only if it's an easy thing to figure out, I don't want to take up much more of your time.

    Now that the post meta is gone it also gets rid of the underline at the bottom. Is there an easy way to add back an underline?

    October 27, 2015 at 4:50 pm #169277
    Porter
    Participant

    Each post has 3 main css sections, entry-header, entry-content, and entry-footer. Knowing this, the ideal solution (most likely), would be to apply an border-bottom to the entry-footer (bottom of each post). Add this style.css (or search for.entry-footer and add the border property below to that section):

    .entry-footer {
      border-bottom: 1px solid #000000;
    }

    Change #000000 to whatever color you want (that'll be black, in case you're unfamiliar with hex), and change the 1px to a larger value if you want the line to be thicker. Lastly, add some padding above and below if the line is too close to the next post / end of your current post to get the spacing just right. Let me know how it goes.


    Buy me a beer? | Try DigitalOcean VPS Hosting

    December 4, 2016 at 4:13 am #196963
    GokulDeepak
    Member

    It works. Thank you guys. And it is interesting about that preference of first condition.

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

© 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