How to Show Relative Dates in WordPress – A Simple Guide

Date:

Share post:

Why It’s Important to Show Relative Dates on Your WordPress Site

When it comes to engaging your website visitors, displaying relative dates can have a significant impact. Social media platforms like Facebook and Twitter have embraced relative dates to provide users with a sense of how recent posts are. By incorporating relative dates into your WordPress site, you can offer your visitors a clearer idea of when something was posted, enhancing the relevance and credibility of your content.

Method 1: Using the Meks Time Ago Plugin

If you’re looking for a simple way to display relative dates on your WordPress site, the Meks Time Ago plugin is an excellent option. Follow these easy steps:

  1. Start by installing and activating the Meks Time Ago plugin.
  2. Go to the Settings tab and select General from the dropdown menu.
  3. Scroll down to the Meks Time Ago Options section.
  4. Specify where and when you want to display relative time (date, time, or both).
  5. Set a time limit for displaying relative dates.
  6. If desired, customize the text for the “ago” label to suit your preference.
  7. Finally, click on the Save Changes button.

Once you have completed these steps, visit your website to see how the relative date appears on your posts and comments.

Method 2: Manually Adding Code with the WP RelativeDate Plugin

If you feel comfortable manually adding code to your WordPress theme, the WP RelativeDate plugin offers a flexible solution. Follow these steps:

  1. Begin by installing and activating the WP RelativeDate plugin.
  2. Check if the plugin automatically replaces the default WordPress dates with relative dates in your theme. If not, proceed to the next step.
  3. Locate the theme files where you want to display relative dates (e.g., single.php or content-single.php for single post pages, comments.php for comments).
  4. Identify the lines in the template files that contain the default date and time display functions (e.g., the_date(), the_time()).
  5. Replace these lines with the following code snippet:
    echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' ago';

Repeat these steps for all the necessary theme files.

In Conclusion

By implementing either the Meks Time Ago or WP RelativeDate method, you can effortlessly display relative dates on your WordPress site. Using relative dates helps your visitors easily determine when a post was published, making it more relevant and credible. Stay tuned for more helpful WordPress articles, such as creating a captivating landing page or discovering the best Facebook plugins for blog growth. Don’t forget to subscribe to our YouTube Channel for more WordPress video tutorials, and connect with us on Twitter and Facebook for the latest updates.

Subscribe to our newsletter

Stay ahead of the game! Subscribe to our newsletter for exclusive tips and insights on Data Structures & Algorithms and interview preparation.

Leave a Reply

Related articles

10 Effective Growth Hacking Techniques to Boost Your Online Influence**

The Influence of Online Power: 10 Techniques for Boosting Growth In today's digital world, having a strong online presence...

Boost Your Productivity with Checklists: An Essential Tool for Every Blogger and Marketer

The Power of Using Checklists: Enhancing Your Efficiency as a Blogger or Marketer In the fast-paced world we live...

Convert Webpages to PDFs: A Simple Guide**

Finding an easy and reliable way to convert webpages to PDF files can be a daunting task. Many...

Mastering Freelance Success: Key Tips for Building a Thriving Career

Keys to Creating a Successful Freelance Business: Essential Strategies and Techniques Introduction: Flourishing in the Freelance Economy As the gig...