• Home
  • WordPress
  • Hosting
    • Budget Hosting
    • Business Hosting
    • Email Hosting
    • Reseller Hosting
  • Domain
    • Domain Pricing
  • Servers
    • Dedicated Servers
    • Vps Servers
  • Security
    • SSLs
      • Domain Validation SSL
      • Extended Validation SSL
      • Organization Validation SSL
      • Wildcard SSL
    • Fix Hacked Website
xoftmade-logo xoftmade-logo
  • Home
  • WordPress
  • Hosting
    • Budget Hosting
    • Business Hosting
    • Email Hosting
    • Reseller Hosting
  • Domain
    • Domain Pricing
  • Servers
    • Dedicated Servers
    • Vps Servers
  • Security
    • SSLs
      • Domain Validation SSL
      • Extended Validation SSL
      • Organization Validation SSL
      • Wildcard SSL
    • Fix Hacked Website
Client Area

How to Display last modified date of posts in wordpress

by xoftmade
November 20, 2014
Blog

There is a blue spot at the end of this post which mentions the “Updated” date. It is the date on which this particular post last modified or updated. Since I keep most of the old posts from time to time, thought it would be a good idea to display the date in the post well.Add the following code at the end of the current theme functions.php update.

1
2
3
4
5
function add_post_content($content)
{
    return $content . '<div class="updated_on">Last Updated On : ' . get_the_modified_time('jS F Y') .'</div>';
}
add_filter('the_content', 'add_post_content' , 9);

The function get_the_modified_time gets the modified time of the current post in any given format. The same is added to the post content using the ‘add_filter’ api function.

The add_filter takes a second parameter called priority. Default is 10, giving anything lesser will mean a higher priority. So we specify 9 to make it higher in priority. Higher priority is needed since many plugins also modify the contents of the post so this function must be able to execute before any other code gets in.

Tags: Display last modified date of posts in wordpresswprdpress modified date
Share:

Recent Posts

  • Duplicate emails from Google/Gmail to cPanel Webmail
  • Critical cPanel & WHM Authentication Flaw Allows Remote Takeover – Patch Now
  • Now SSLs will Expire in Just 200 Days why!
  • How to disable alt-php binaries from cPanel MultiPHP Manager
  • How to enable or disable root user login in Linux Servers?

Recent Comments

No comments to show.
xoftmade-logo
P50 Plaza, 2nd Floor, Chenab Market, Susan Road, Faisalabad
+92 311 4991414

sales@xoftmade.com

Hosting
  • Managed WordPress Hosting
  • Budget Hosting
  • Business Hosting
  • Email Hosting
  • Reseller Hosting
Company
  • About
  • Blog
  • Affiliate Marketing
  • Terms of Service
  • Contact
Domains
  • Domain Search
  • Domain Pricing
  • WHOIS Lookup
Join Our Newsletter

We’ll send you news and offers.

Social Media
Facebook-f Instagram
© All Rights Reserved - Xoftmade Web Solutions