#19 Make Your Blog Post Timestamp Relative Time Like Instagram

Amy Marsh Is A Fashion Technologist In Training

12 minutes ago

 

Today I have been coding in the Timberyard, it’s an internet cafe on Old Street in London that is definitely a firm favourite for chloédigital,with tea timed to perfection, and a tomato paste people could fight over it’s a nice setting to sit, eat and code away.

 

In this post I will be showing you how to add a time stamp that will tell your readers exactly how long ago an article was posted, just like how Instagram does! Why? It is a cool way for readers to see how active you are on your blog.

 

Let’s get started!!

 

 

Start by opening up your Functions.php file, and add this section of code to the bottom of the file:

 

 

This function is what calculates how long ago each blog post was posted, to be able to use this function we now need to add /edit another function to this file.

 

Next search for the function called ‘toolbox_posted_on’ and replace the code with this, as I have now referenced the relative time function:

 

 

Please note you will need to of downloaded Font Awesome so you get the cute little clock so if you haven’t follow the steps here.

 

The toolbox theme we are using has this function. If you don’t have the toolbox theme paste this into your functions.php and reference it where you would like the time to show.

 

E.g for us here in our content-single.php file is our function (<?php toolbox_posted_on( ); ?>)  in the header tag and that is why it appears there:

 

 

DAY 19 COMPLETE!

Leave a comment with any questions or to submit your progress and make sure to check out the blog tomorrow and see what has changed!

Stay Updated

If you enjoyed this post, subscribe to the Fashion Technologist for updates

What are you interested in?

Discover more:
email course
(blog)Random Banner Ad Featured Image
Screen Shot 2014-06-10 at 17.43.10
two ways to make your site more secure
(feat) theFEED Profiles- RooftopAntics.com
How to change the default media linking option in wordpress
Why I do not like blog posts being By Admin
how to create a wordpress plugin

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">