Lightning Rank - Private Blog Network

  • Home
  • Done 4 You PBN Service
  • Use My Premium PBN
  • Other Services
    • Amazon Associate Audit
    • Editorial Links
    • Backlinks Analysis
    • Buy Expired Domains
  • Contact
    • Affiliates

How To Display WordPress Post Date As Time Ago Posted “X” Days Ago

November 20, 2015 By Jon Gillham Leave a Comment

This WordPress Tutorial will teach you how how to display the WordPress post date as Time Ago eg, “posted 6 Days ago” in place of the more traditional WordPress post date format of 1st May 2012 for example. You will be required to edit some of your WordPress themes template files to achieve this change on an existing theme. As always we also recommend that you use a code focused text editor when editing any template files.

Firstly you will want to find the instances of the post date function within your existing themes template files, the function you are looking for will be similar to the example below. Your exact date function may also have letters contained in the code snippet, this is normal and is the snippet you are looking for.

Basic Files To Check

  • index.php
  • single.php
  • tag.php
  • category.php
  • *-loop.php.php
<?php the_date(); ?>

To display your date function as time ago replace all of your original date function snippets contained within your theme template files with the code below.

<?php echo human_time_diff(get_the_time('U'), current_time('timestamp')) . ' ago'; ?>

Any questions or improvements on this technique as always please leave a comment.

Filed Under: Wordpress Tutorials Tagged With: wordpress hack, wordpress post date, wordpress tutorial

Leave a Reply Cancel reply

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

Services

Recent Posts

  • What It takes to get to #1 in Google
  • Private Blog Network Building Service in 2016 – Is It Still Worth The Risk?
  • UpThemes Scale Back On Theme Options Within Their WordPress Themes
  • Create A WordPress Login Form Shortcode For Your Blog
  • WooThemes Back Online After Malicious Hack & Further DDoS Attack

Our Team

Jon Gillham

Father, Husband and mechanical engineer. Jon has the easy job he builds and tests systems that Kelley, Hmd and their teams execute!
Kelley Jones

Project manager/customer service leader. If you have a problem Kelley makes it her lifes mission to solve it for you!
Hmd

Hmd is the man that makes sure everything runs smoothly. A true jack of all trades he makes sure each site is built to our high standards!

Quick Contact

Checking...

Ouch! There was a server error.
Retry »

Sending message...

Copyright © 2019 . Experts at Harnessing the Power of Expired Domains to Help You Outrank Your Competition