Thesis Tutorial – Custom Post Dates
-
The following post is part of my Thesis tutorial series. In this post, we’re going to be looking at how to customize your date display.
In the past 12 months, Google has gotten much more aggressive about displaying dates in SERP listings. Since many of the sites I publish have evergreen content, they suffer from lower SERP CTR when “old” dates are shown in the SERPs.
However, as has been pointed out, I am doing my readers a disservice by not showing the date on the post. So I’ve come up with a workaround that lets me display the date for users–but in a format that Google currently can’t extract.
This tutorial is written for Thesis (see my Thesis wordpress theme review) but can be adapted if you are using another theme. First, make sure you turn off the author’s name and date. To do this, go to thesis > design options > display options > bylines and uncheck the box.
Now your post should have no date or author. Next, open up the custom functions file and create a new function. I’m calling mine “uauthor_byline”.
//this is author byline
function uauthor_byline() {}You’ll need some logic to display the dates only on single post pages. Here it is.
if (is_single()){ }Inside of that function, you will need some date logic that figures out how old a post is and decides between two display variations. Set a variable for the post age, as shown below.
$daysold = (current_time(timestamp) - get_the_time('U') - (get_settings('gmt_offset')))/(24*60*60);
if ($daysold < 180) { } else { }Here’s the logic to change the display based on post age. I’m going with 6 months, which is 180 days. If a post is less than 180 days, I’ll show the full date; if it’s older than 180, I’ll only show the month and year.
if ($daysold < 180){ } else {}The only other thing you will need is a link with the author’s name.
Written by on <Bring everything together like this:
//this is author byline
function uauthor_byline() {
$daysold = (current_time(timestamp) - get_the_time('U') - (get_settings('gmt_offset')))/(24*60*60);if (is_single()){ ?>
Written by on
if ($daysold < 180){ } else {}
?>The last thing to do is call the function in the right place. In this case, you will use the before post hook, like this:
add_action('thesis_hook_before_post','uauthor_byline' );And here are the two variations–one just before the 180 days and one just after.
It should be noted that this is a workaround and, at some point, Google may get smart enough to interpret this or adjust its date algo. At some level, we are engaging in a bit of trickery for our own benefit. If you want to avoid this “little white lie,” you should update your evergreen content regularly and use a seasonal living URL strategy. This ensures you give the users the most up to date info without tricking anyone.
If you want to use this tutorial, it works best with the Thesis Theme. If you purchase from that link, I do receive a commission; however, I use Thesis on this website and many others and am very comfortable recommending it. If you want to spend less time playing with theme and more time creating content, Thesis is an excellent platform to do it on.
Register Your email to receive news Posts !
-
▼
2011
(24)
-
▼
April
(15)
- Earn More with Adsense: Tips & Layout Optimization...
- Google Chrome 11.0.696.57 Stable Released - Direct...
- Thesis Tutorial – Custom Post Dates
- 5 Google Adsense Secrets, Tips and Tricks
- Google Adsense Tips, Tricks, and Secrets
- How to Get More Subscribers for Your Email List
- Is Commenting on Blogs a Smart Traffic Strategy?
- 101 Ways to Build Link Popularity
- 5 Tips To Increase Your Adsense Revenue
- Basic Adsense Tips
- Greatest Blog Design Inspiration of 2010
- 101 Web Marketing Ideas and Tips
- How to Attract Links and Increase Web Traffic – Th...
- How to Increase Website Traffic
- How To Make Money With Google Adsense
-
▼
April
(15)
-
►
2010
(9)
-
►
May
(9)
- 9 Tricks I Used To Triple My AdSense Earnings In 3...
- New Adsense Tips
- Top 15 AdSense tips
- 100% Google AdSense: Tools, Tips and Resources
- Earn More with Adsense: Tips & Layout Optimization...
- Google Adsense Tips, Tricks, and Secrets
- Google AdSense Tips
- How to Increase Website Traffic
- Top Paying Google Adsense Keywords List
-
►
May
(9)





