Why add ‘Last Updated’ to Genesis WordPress Themes?
I was reading an article over at Viper Chill about how new ‘fresh’ content appears to be ranking above highly regarded older content in Google these days. From the tests that Glen at Viper Chill ran over the course of a year (with 100 or more search terms) he found that fresh content would outrank old stuff in most cases. Even if the fresh content was spammy and the old stuff was good quality.
As you can imagine this caused a real stir.
On this blog I deliberately removed the post date because I knew people often ignore older information in preferences to the latest stuff. I thought that if I removed the date then people wouldn’t be influenced by this factor and would read my content based on it’s quality. However, after reading the above article I came away thinking that dates on blog posts are important after all as they take advantage of the freshness element of the Google algorithm.
Making your content appear fresh to Google
I decided that using the post date on my WordPress blog was a bad idea. This dates the post badly and would lead to poor Google rankings. However, I do update my posts quite often – even the older ones – so I decided that I should use ‘last updated’ as my post date instead. That way the information looks fresh to Google and to my readers.
Adding ‘Last Updated to ‘Genesis’ – surely it’s easy
I uses the Genesis Theme on my blog so I had to figure out how to add the post update date instead of the post date. I thought that swapping out the code for for something like [latest_update] would do the trick. My first port of call was the shortcode reference on the Genesis website but when I checked it out I realized there was no shortcode that I could use.
So I had to come up with a plan that allowed the date to appear without hacking the core code in Genesis. With a little help from The Customize Window and Genesis plugins Genesis Simple Edits and Genesis Simple Hooks I was able to get the effect I was after.
How To Add ‘Last Updated’ To Genesis WordPress Themes
- Login to the admin area of your WordPress website
- Select Plugins > Add New from the menu
- In the search box type in ‘Genesis Simple Edits‘ and click search plugins
- Click ‘Install Now’ below the item ‘Genesis Simple Edits‘
- Click OK to say you are happy to install the plugin
- Let the plugin install and on the next screen that appears click ‘Activate Plugin’
- Repeat steps 2 -6 for the ‘Genesis Simple Hooks‘ plugin
- Select Genesis > Simple Edits from the menu
- In the top box called ‘Post Info’ remove all of the text and click ‘Save Settings’
- Select Genesis > Simple Hooks from the menu
- Scroll about half way down the list of hooks to ‘
genesis_after_post_title
Hook’ - In the box copy and paste this code (see the end of this post for an explanation of the code):
<?php $u_time = get_the_time('U'); $u_modified_time = get_the_modified_time('U'); if($u_modified_time != $u_time) { echo "<p style = 'font-size: 80%'>Last updated : "; the_modified_time('j F Y'); echo "</p>"; } ?>
- Underneath put a tick in the box that says ‘Execute PHP on this hook?’
- Click any Save Changes button on the page
What the code means
The code that you used finds the modified date and time and then displays it under the post title at 80% of it’s original size.I don’t actually show the update time, just the date – but you could add this if you wish. Simply update the line that says:
the_modified_time('j F Y');to:
the_modified_time('l, j F Y g:i A');
Did you find this article helpful?
If you found this article helpful please take a moment to tweet, like, or share this article by using the buttons at the top or bottom of this page. I’d really appreciate it. 🙂
Also, if you are feeling really generous please leave some encouraging feedback in the comments section at the bottom of the page. I love getting feedback from visitors.
Shea says
Hello Kevin, I came across this post late. Is it possible to have an option of whether or not you want the “last updated” date to take affect? In other words, if I go back to an older post to fix a typo for example and then click update, it will bump the date up to the current date correct?
I would rather have it as an option to eliminate the risk of having multiple posts with the same “last updated” date if I was making wholesale changes of say images within those posts and not really changing much in content.
Akash says
I followed your method, but instead of one I am getting two errors. Surprisingly, even this page of yours shows the same errors.
Error: Missing required field “updated”.
Error: Missing required hCard “author”.
When did you last check it? Please post an update on this post. Thank you in advance!
Kevin Craighead says
That is odd – when I check using Chrome and Firefox on my Mac the date appears properly. It also works on Firefox and IE on a PC. What browser are you using?
Glenys says
Thanks Kevin, this was just what I was looking for!
I’ve always debated about whether or not dates should be included, especially after reading Glen’s article that you refer to. But because I get irritated myself when dates are missing in the SERPs, I decided to re-include them on my own blog. And now that I have come across this idea, of replacing the published date with the updated date, it provides a perfect solution.
It is so much easier to follow step-by-step guidelines like you have listed in your post, especially when tweaking Genesis code, thanks.
Manivasagam says
Hi, thanks for the awesome tutz, which i was looking for genesis .. one thing i like to ask,
The code youve given does the same function as this one ??
Last updated on
<time datetime="”>
i found this code on wpbeginner , so just does both are same or different ?? If yes,
Can i just replace the code you’ve given with this one on the genesis simple hooks > genesis_after_post hook ??
Please reply ..
Kevin Craighead says
Thanks for the reply!
I would follow the tutorial and change the code as per my instructions. I’m not saying what you have found won’t work – it’s just that I know the fix I have posted does. 🙂