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.
PHP Code
Here’s the code which is already provided by StudioPress:
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.
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.
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
- Here’s a post showing different ways to remove post meta rather than post info.
- And here’s another post which shows you 3 ways to remove post meta & post info from Genesis.
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.
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!
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.
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!
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:
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).
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:
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
Don’t understand your question Robb.
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.).
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.
Yes. Its normally included in the default post info.
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.
Happy to help Paul
Thanks for the positive comment.
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!
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.
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.
Try this http://wpsites.net/seo/add-last-updated-date-to-post-info-in-genesis-2-0-html-5-themes/
DO you have anything like same for blogger user?
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.
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!
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.
but that HTML of your last code redirect to the home page… to be more specific, when i add the next code from studiopress
In all the pages i get only this format: – leave a comment
instead of this: 7 septiembre, 2013 by Author – Leave a Comment (Edit)
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.
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.
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.
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.
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?
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?
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.
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
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:
2. You can add a conditional tag after the function like:
3. Or you can add the one line of PHP to remove the post info directly to a archive or single template file.
For some reason, this 3rd solution may not always work.