To Edit Author and Date Post Information, simply add the following to your functions.php file. This code uses Genesis specific shortcodes.
[php]// Modify Post Info
add_filter('genesis_post_info', 'my_post_info_filter');
function my_post_info_filter($post_info) {
if (!is_page()) {
$post_info = '[ post_date] by [ post_author_posts_link] at [ post_time] [ post_comments] [ post_edit]'; //remove spaces after initial [
//$post_info = 'Custom text'; //edit this to whatever you'd like.
}
return $post_info;
}[/php]
Available shortcodes are (without the space in front):
- [ post_date]: Date of publication; e.g., [ post_date format="F j, Y" label="Dated: "] =
- [ post_time]: Time of publication; e.g., [ post_time format="g:i a"] =
- [ post_author]: Displays author's name; e.g., [ post_author before="<em>" after="</em>"] =
- [ post_author_link]: Produces the link to Author URL; e.g., [ post_author_link before="" after=""] =
- [ post_author_posts_link]: Produces the link to Author's Archive; e.g., [ post_author_link before="" after=""] =
- [ post_comments]: Produces the Comment Link; e.g., [ post_comments zero="No Comments" one="1 Comment" more="% Comments"] =
- [ post_tags]: Displays the tag link list; e.g., [ post_tags sep=", " before="Tags: "] =
- [ post_categories]: Displays the category link list; e.g., [ post_categories sep=", " before="Posted Under: "] = Posted Under: Genesis, Tutorials
- [ post_edit]: Displays the Edit link for logged in users; e.g., [ post_edit before="(" after=")"] =
For more shortcodes, see StudioPress's Shortcodes.
eli says
Hello there,
thanks a lot for this tip. I’ve entered the exact information in my functions file, but where should I see the options to edit author and date post information? Nothing has changed on my posts edit pages.
Thanks a lot and best regards,
Eli
wpsmith says
Edit this line: $post_info = ‘[ post_date] by [ post_author_posts_link] at [ post_time] [ post_comments] [ post_edit]’; accordingly. If you don’t want the date, remove [ post_date]. If you don’t want the author, remove by [ post_author_posts_link]. If you want to designate a specific author, then change [ post_author_posts_link] to MyName or whatever you’d like. Please let me know what exactly you want and I can help.
LiLo says
Hi, is there a way to edit post info for specific posts only? Thanks
Travis Smith says
Yes there is:
[php]<?php
// Modify Post Info
add_filter( ‘genesis_post_info’, ‘my_post_info_filter’ );
function my_post_info_filter( $post_info ) {
global $post;
if ( in_array( $post->ID, array( 1, 2, 3, 4123, 432, ) ) { //edit the numbers to whatever post IDs you’d like.
$post_info = ‘[ post_date] by [ post_author_posts_link] at [ post_time] [ post_comments] [ post_edit]’; //remove spaces after initial [
}
return $post_info;
}
[/php]
john Chadwick says
Hi there. I am customising a theme for a client and the client wants the post info to display only on certain categories. I have customised the post info site wide but can’t figure out how to discriminate the post category. The theme is a a customised Enterprise child theme on the Genesis framework. Really hoping you can help and thanking you in advance.
Best Regards
John Chadwick
john Chadwick says
Sorry to post immediately after my initial post but I managed to crack the problem of disabling post info for certain post categories : Code added below
/** Customize the post info function */
add_filter( ‘genesis_post_info’, ‘post_info_filter’ );
function post_info_filter($post_info) {
if (!is_category(‘Testimonials’)) {//CUSTOM Dont display date for testimonials
$post_info = ‘[post_date]‘; //CUSTOM removed [post_author_posts_link] at [post_time] [post_comments] [post_edit]
return $post_info;
}}
Best Wishes
John Chadwick
Evy says
Hi Travis
I’m working on a site that currently doesn’t display the date. Whenever I try adding [ post_date format=”F j, Y” label=”Dated: “] to the functions.php file the site gets messed up. I don’t really understand WHERE to add it in the .php file, can you help pinpoint where it should be placed?
Thanks!
Evy
Travis Smith says
Hello Evy,
You have to add the entire function to your functions.php code.
Thanks,
Travis
Saku says
Hi Travis,
Nice and thorough posting on this subject. A quicky though: I’m trying to edit the text that is shown with [post_edit] , any easy way of doing this?
Thanks,
Saku
Beena says
Is there a way to add twitter link in user meta or under post tittle?