How to change published date to last updated with Genesis Framework

2
122 followers
Updated

I found a WordPress source code that shows you how to change the published date to last updated on Genesis Framework at this blog.

It has to be placed in functions.php which can be found by going into Appearance >> Editor in the WordPress Dashboard.

I am not sure if this works with other themes beside Genesis.

Here is the actual code. I wouldn't worry too much about the formatting. Just copy and paste into functions.php.

//* Create shortcode to store the proper date
add_shortcode( 'post_updated_date', 'rv_set_last_updated_date' );
function rv_set_last_updated_date( $atts ) {
if ( get_the_modified_time() != get_the_time() ){

$last_updated .= 'Last updated on ' . the_modified_date('M jS, Y','','',false);
return $last_updated;

} else{

$published_on .= 'Published on ' . get_the_time('M jS, Y',false);
return $published_on;

}
}

//* Do those shortcodes when the post has been updated

add_filter( 'genesis_post_info', 'rv_post_info_filter' );
function rv_post_info_filter( $post_info ) {
if ( is_home() ) {
$post_info = '[post_updated_date] By [post_author_posts_link]';
return $post_info;
} else {
$post_info = '[post_updated_date] by [post_author_posts_link] [post_comments before=""]';
return $post_info;
}
}

I took out one little part in the code above that showed the categories but it is still in the original code provided at the link.

I would like to thank you for reading and I hope that this helps you.

Have a blessed day!


Login
Create Your Free Wealthy Affiliate Account Today!
icon
4-Steps to Success Class
icon
One Profit Ready Website
icon
Market Research & Analysis Tools
icon
Millionaire Mentorship
icon
Core “Business Start Up” Training

Recent Comments

2

Sounds great, but I wonder if this would change my Permalink (date/name)

Hi Sonja :) Sorry for the late reply.
As far as I know, the code only changes the word "published on" to "last updated".
Also, if you never update the post, it will just show the published date.
Hope that helps you.

See more comments

Login
Create Your Free Wealthy Affiliate Account Today!
icon
4-Steps to Success Class
icon
One Profit Ready Website
icon
Market Research & Analysis Tools
icon
Millionaire Mentorship
icon
Core “Business Start Up” Training