Home » Labs » Function for Showing post date and the last modified date on wordpress site  

Function for Showing post date and the last modified date on wordpress site


Filed under Labs

Following snippet that will display the last modified date with your post along with the date posted as long as the dates are not the same.

 
Posted on <?php the_time('F jS, Y') ?>
<?php 
          $u_time = get_the_time('U');
          $u_modified_time = get_the_modified_time('U');
 
      if ($u_modified_time != $u_time) {
                echo "and last modified on ";
                the_modified_time('F jS, Y');
                echo ". "; 
          } 
?>

Posts you may like: