Home / date / Show post date & the last modified date
  • How to Show post date & the last modified date

    wordpress-the_loop-the_title-the_meta-the_excerpt-the_author

    This is a simple little 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.

    ( click code to copy )

    wordpress snippet : PHP

    <>
    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 ". ";
              }
    ?>
    

    ( WordPress codex functions, hooks, in this snippet. )

    get_the_modified_time, get_the_time, the_modified_time, the_time,