Quantcast
Channel: Crunchify
Viewing all articles
Browse latest Browse all 1037

How to Display ‘Last Updated On: Date/Time’ of your WordPress Blog Post? Genesis Framework Hook Included

$
0
0

Search Engine Optimization (SEO) is a very big topic. There are lots of consideration you have to keep in mind in order to have correct SEO implementation for your blog. Google shows post publish date in search result page.

Google Last Updated Date How to Display Last Updated On: Date/Time of your WordPress Blog Post? Genesis Framework Hook Included

Sometimes you may have to modify blog post if you find some code bug or typo. In such a case it’s advisable to update date appropriately. Let’s say you have published post on 1st December 2014 and for some reason you update post on 4th December 2014 then post should tell 4th December, 2014.

Making your content appear fresh to Google. Let’s get started:

Look at below changes:

Genesis Framework Date Time How to Display Last Updated On: Date/Time of your WordPress Blog Post? Genesis Framework Hook Included

WordPress Genesis Framework Last Updated on Added How to Display Last Updated On: Date/Time of your WordPress Blog Post? Genesis Framework Hook Included

I’m using Genesis Framework, and it’s very easy to update this with simple hooks. Just put below code to your child themes functions.php file and you should be all good.

function crunchify_get_updated_date_for_post() {
    $date = '<i>' . get_the_modified_date() . '</i>'; 
    return $date;
}
add_shortcode( 'crunchify_modified_date', 'crunchify_get_updated_date_for_post' );

add_filter( 'genesis_post_info', 'crunchify_add_updated_date_info' );
function crunchify_add_updated_date_info($post_info) {
	$post_info = 'Last Updated on [crunchify_modified_date] by [post_author_posts_link] [post_comments] [post_edit]';
	return $post_info;
}

If you are not using Genesis Framework and want to achieve the same then follow below steps:

Step-1

Open below files:

  1. index.php
  2. page.php
  3. single.php

Step-2

Look for an entry for post meta in above files i.e. Posted on or Updated on  and update this accordingly.

<?php if (get_the_modified_time() != get_the_time()) : ?>
		<p>Posted: <?php the_time('F jS, Y'); ?> at <?php the_time('g:i a'); ?>, Last Updated on: <?php the_modified_time('F jS, Y'); ?> at <?php the_modified_time('g:i a'); ?></p>

	<?php else: ?>
		<p>Posted: <?php the_time('F jS, Y'); ?> at <?php the_time('g:i a'); ?></p>
<?php endif; ?>

What is your plan? Are you planning leave Default WordPress Date or planning to update your blog which shows Last Updated on: Date?

Have anything to add to this article? Please chime in and join the conversion.


The post How to Display ‘Last Updated On: Date/Time’ of your WordPress Blog Post? Genesis Framework Hook Included appeared first on Crunchify.
Author: Arpit Shah


Viewing all articles
Browse latest Browse all 1037

Trending Articles