4 Ways To Remove, Hide or Customize Specific Post Info Links in Genesis

Brian Gardner has already provided PHP code you can use to remove the post info links from single posts. The code snippets also include code for customizing the post info links.

But what if you don’t want to remove the post info links from all categories and posts? What if you want to keep them displayed on one or more categories but remove them from others?

In this tutorial, you’ll learn how to remove specific post info links from specific categories and keep the links displayed on posts in other categories using conditional tags. And you’ll also learn how to hide post info links using CSS code and remove them completely using plugins.

Note: The PHP code below may not work if you also activate the Genesis Simple Edits plugin

PHP Code

Here’s the code which is already provided by StudioPress:

Note: For ALL PHP code snippets on this post, you need to remove the shortcodes for the post info you do NOT want displayed. Example: Remove the author shortcode if you want to remove the author but keep the date and comments link displayed

Here’s an example. This code removes the date and author but leaves the comment and edit link in the post info. You can see the shortcodes for both have been removed from the code:

Here’s the code which includes all the shortcodes so it will not remove any unless you remove theme from the code based on your own preferences.

And here’s the code i have written which enables you to remove the post info from posts in all categories but keep it displayed on posts in one category, which in this example, is the news category.

Remove Post Info Specific Pages

This code will remove the post info from 2 pages using the post i.d for each page in an array. You can change the i.d’s and add more to the array separated by a comma.

Remove All Post Info

This code can be added to your functions file to remove all the post info from your entire site or added to a template file to remove only on pages/posts using the template.

Remove All Post Meta

This code can be added to your functions file to remove all the post meta from your entire site or added to a template file to remove only on pages/posts using the template.

Remove Post Info Specific Pages

But wait!

That’s not the only way to remove post info links from Genesis.

CSS Code (XHTML)

You could also hide them using CSS code.

CSS Code (HTML 5)

Hide all Post Info Site Wide

.entry-meta {
display: none;
}

Hide the Date Site Wide

.entry-time  {
display: none;
}

Hide The Author Name Site Wide

.entry-author {
display: none;
}

Note: The above code will not hide the by text before the author name so you will need to use PHP code for this.

.entry-comments-link {
display: none;
}

You can also use these classes in the same rule like this:

.entry-comments-link,
.entry-time {
display: none;
}

Or you can use CSS code to hide the post info from specific pages like this:

.home .entry-comments-link {
display: none;
}

The above code hides the comments link from the home page only.

Genesis Simple Hooks Plugin

Another option is to unhook them using the Genesis Simple Hooks plugin.

Unhook genesis_post_info using simple hooks

Genesis Simple Edits Plugin

The fourth way to remove post info links is to install the Genesis Simple Edits plugin and remove the shortcodes. This clearly is the easiest method for beginners however it removes them site wide.

genesis simple edits

In the screen shot above, you can see 4 shortcodes which output the 4 types of post info links:

  • Post date
  • Post Author Posts Link
  • Post Comments
  • Post Edit

Removing Post Meta & Post Info

Replacing Post Info Shortcodes With HTML Links

You can also remove a shortcode and replace it with a custom HTML link like this:

Conclusion

Is there another way to customize, remove completely or hide post info links in Genesis?

I don’t think so as we have covered all bases in this tutorial.

Here’s some plugins which you may find useful when customizing WordPress.

Related Tutorials


Comments

31 responses to “4 Ways To Remove, Hide or Customize Specific Post Info Links in Genesis”

  1. Jessie Avatar

    Hello! Thanks for writing such a great post! I was wondering if you knew how I could move my post info (Date/Name/Comments) from before my post content, to after my post content? Really struggling with this one somehow. Any help would be appreciated! Thanks so much!

    1. Brad Dalton Avatar
      Brad Dalton

      Hello Jessie

      You’ll find there’s different ways to re-position the entry meta from the entry header to the entry footer which i have already written about on this site.

      The easiest method is to install the Genesis Simple Edits plugin and add the shortcodes to the entry footer.

  2. Gretchen Louise Avatar
    Gretchen Louise

    Is there any way to apply different CSS to the day than to the month and the year? i.e. I’d like the numeral date to be a larger font than the month and the year. Thank you!

    1. Brad Dalton Avatar
      Brad Dalton

      Not something that is easily done because the date is generated by a shortcode in the Genesis files so you would need to modify that code in your child theme and add classes for each part of the date then use CSS to style it differently.

      In genesis > lib > shortcodes > post.php you’ll find this code:

      1. Gretchen Louise Avatar
        Gretchen Louise

        That’s what I was thinking. Thank you!

        I was able to make it work with this code (multiple post_date shortcodes did not work in Simple Edits).

        1. Brad Dalton Avatar
          Brad Dalton

          Excellent!

          Thanks for sharing Gretchen.

          How did you style them?

          You could try using this declaration with the class for your post info so it displays inline rather than wraps into a list:
          [code]
          white-space: nowrap;
          [/code]

  3. Robb Gorringe Avatar
    Robb Gorringe

    Hi Brad,

    Is there a way to show # of comments on my home page, not just when you view the actual blog post? Maybe in Genesis – Simple Edits?

    Thanks,

    Robb

    1. Brad Dalton Avatar
      Brad Dalton

      Don’t understand your question Robb.

      1. Robb Gorringe Avatar
        Robb Gorringe

        Sorry Brad. I’m looking for something like a ‘comment bubble’ that would work with Metro Pro, to show the number of comments on each post, (so that it increases reader engagement.).

        1. Brad Dalton Avatar
          Brad Dalton

          I would grab that from the code in the Twenty Eleven theme.

          Or you maybe able to find a plugin which does that as well.

    2. Brad Dalton Avatar
      Brad Dalton

      Yes. Its normally included in the default post info.

  4. Thank you for this comprehensive look at modifying post-info. Most posts would have only described one way to do it and left it at that.

    1. Brad Dalton Avatar
      Brad Dalton

      Happy to help Paul

      Thanks for the positive comment.

  5. Can you tell me how I would go about removing the comment meta link. I only want to retain the date (remove time) as text.
    Thanks!

    1. Brad Dalton Avatar
      Brad Dalton

      You can remove the shortcode from the PHP code used to customize the post info.

      Or you can remove the shortcode from the post info field after installing the Genesis Simple Edits plugin.

      Note: Generally, you cannot use the Simple Edits plugin and PHP code at the same time as they both use the same hooks.

  6. I have another question: Is there a way to show the modifed date instead of the publication date via shortcodes or how would I change that? I also use Genesis, but could not find that out. Thanks in advance! That was a very helpful post, by the way.

  7. ambarish Avatar

    DO you have anything like same for blogger user?

    1. Brad Dalton Avatar
      Brad Dalton

      I can only suggest you move your content to WordPress as you have far more control over customization of your site and access to files/code.

  8. Help me please. I want to modify the text of the comments in the post info but, when i use the code that studiopress provide for this, it deletes all the post info (date, author and edit) and only shows the comments text. How i can modify the comments text, keeping the post info by default? Thanks in advance!

    1. Brad Dalton Avatar
      Brad Dalton

      Santiago

      The code above works as i always test it and the first snippet is from StudioPress who do the same.

      I tested the code again and it works on both XHTML and sites running HTML 5.

      To modify the comments text you need to remove the shortcode and add HTML.

      I’ve added an example to this post which you can use or modify.

      1. but that HTML of your last code redirect to the home page… to be more specific, when i add the next code from studiopress

        [code]
        //* Modify the comment link text in comments
        add_filter( ‘genesis_post_info’, ‘sp_post_info_filter’ );
        function sp_post_info_filter( $post_info ) {
        return ‘[post_comments zero=”Leave a Comment” one=”1 Comment” more=”% Comments”]’;
        }
        [/code]

        In all the pages i get only this format: – leave a comment
        instead of this: 7 septiembre, 2013 by Author – Leave a Comment (Edit)

        1. Brad Dalton Avatar
          Brad Dalton

          Its only an example url.

          You can easily change it to anything you like.

          Is that code what you wanted or did you need anything else?

          Its very easy to modify the post info code and add or remove links and shortcodes.

  9. AnitaC Avatar

    I was trying to use this:

    [php]/** Remove the post meta function */
    remove_action( ‘genesis_after_post_content’, ‘genesis_post_meta’ );
    add_filter( ‘genesis_post_info’, ‘post_info_filter’ );
    function post_info_filter($post_info) {
    if(!is_page(array(‘408’, ‘422’))) {
    remove_action( ‘genesis_before_post_content’, ‘genesis_post_info’ );
    }
    else {
    add_action( ‘genesis_before_post_content’, ‘genesis_post_info’ );
    }
    }[/php]

    It removes it from everything. Even if I remove the ! out of there. I’ve been trying to figure out what I am doing wrong.

    1. Brad Dalton Avatar
      Brad Dalton

      Anita

      I just added sample code you can use to remove post meta and post info from specific pages in Genesis.

      Note: The PHP will not work in some cases when the Genesis Simple Edits plugin is activated although it will not cause any errors.

  10. AnitaC Avatar

    Hi Brad, I never received the email that you posted this replay. What I am looking for is to remove post info and post meta from specific pages and posts by ID number.

    1. Brad Dalton Avatar
      Brad Dalton

      Here’s an example Anita.

      .page-id-11465 .post-info .author, .post-info .date {
      display: none;
      }

      You can use this with the post-meta classes as well.

      You’ll need to grab your own i.d’s from the source code.

      The PHP code above also provides the solution however you will need to change the conditional tag to is_page() and add the i.d in between the brackets.

      I’ve also written a post about how to hide post meta using CSS code.

      Have i missed something?

  11. AnitaC Avatar

    Hi Brad, how would I use this if I wanted to use the post info from specific pages only? And can it be used for post meta?

    1. Brad Dalton Avatar
      Brad Dalton

      Hi Anita.

      I just updated the post with links to 2 more articles showing different ways to remove post meta and post info.

      Basically, you can either use CSS or PHP code.

      With CSS, you use the post/page/category i.d which you grab from the source code in the body class.

      With PHP code, you use conditional tags and it also removes the output.

      CSS only hides the links from display so they remain in the source code.

      If you let me know the specifics, i’ll write the code for you.

      1. AWESOME post! I’m wondering- how would you go about removing/hiding in just a certain Custom Post Type? That is one application i haven’t been able to identify a solution for! Thanks for the great writeup

        1. Brad Dalton Avatar
          Brad Dalton

          Hey Brad. You have multiple choices.

          Here’s 3 of them:

          1. You can use CSS with the body class for the CPT which you can grab from the source code. Example:
          [code]
          .post-type-archive-portfolio .entry-meta {
          display: none;
          }

          .single-portfolio .entry-meta {
          display: none;
          }
          [/code]

          2. You can add a conditional tag after the function like:
          [code]
          if ( is_post_type_archive(‘portfolio’))
          or
          if ( is_singular(‘your-post-type’))
          [/code]
          3. Or you can add the one line of PHP to remove the post info directly to a archive or single template file.
          [code]
          //* Remove the post info function
          remove_action( ‘genesis_entry_header’, ‘genesis_post_info’, 5 );
          [/code]

          For some reason, this 3rd solution may not always work.

Leave a Reply

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.