Since I frequently update posts so it’s crucial for me to display last modified date instead of post published date like following image. Its because I want search engine to display my post last modified date not post published date. Can anyone help me regarding this issue any help would be appreciated.
2 Answers
Try using the_modified_date() or the_modified_time(), which should display the last updated date.
-
i know that since i'm not expert in coding i'm not being able to implement it properly :( Jul 27, 2013 at 15:50
-
Genesis displays post date using the shortcode [post_date]
and also lets you filter the post info..
Try this..
add_shortcode('post_updated_date', 'set_last_updated_date');
function set_last_updated_date($atts) {
if (get_the_modified_time() != get_the_time()){
return 'Last Updated on ' . the_modified_date('M jS, Y','','',false);
} else {
return 'Published on ' . get_the_time('M jS, Y',false);
}
}
add_filter( 'genesis_post_info', 'post_info_filter' );
function post_info_filter($post_info) {
if (is_home()) {
$post_info = '<span class="home-meta"><time itemprop="dateModified" class="datetime entry-time">[post_updated_date]</time> By<span class="author"> [post_author_posts_link]</span><span class="entry-meta-content hidden-phone"> [post_categories before=" In "]</span></span>';
} else {
$post_info = '<span class="entry-meta-content"> [post_author_posts_link]</span><span class="entry-meta-content"> [post_updated_date]</span><span class="entry-meta-content"> [post_categories before=""]</span><span class="entry-meta-content"> [post_comments before=""]</span>';
}
return $post_info;
}