Change post date to last modified

Discussion in 'ReThink WordPress Theme' started by selfmade, Feb 20, 2015.

  1. selfmade

    selfmade Guest

    Joined:
    Feb 4, 2015
    Messages:
    49
    Likes Received:
    0
    Hi, I would like to have my posts show the date last modified rather than published.Do you have any tips on how to do this in rethink? Thanks.
    1​

     
  2. Pramod

    Pramod Guest

    Joined:
    Aug 8, 2014
    Messages:
    2,847
    Likes Received:
    63
    Hello !

    You can use below code in single.php file in the place of published date. This will show both published date as well as last modified date.

    Code:
    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 ". "; } ?>
    Thanks & Regards
    Pramod
     
  3. selfmade

    selfmade Guest

    Joined:
    Feb 4, 2015
    Messages:
    49
    Likes Received:
    0
    Anyway of just displaying the last modified date only? thanks so much.
     
  4. Pramod

    Pramod Guest

    Joined:
    Aug 8, 2014
    Messages:
    2,847
    Likes Received:
    63
    Hello !

    Please use this code in loop.php and single.php from Appearance=>editor

    Code:
     <li class="date">Last modified on&nbsp;<?php the_modified_time('F jS, Y');?></li>
    instead of
    Code:
    <li class="date">Posted on &nbsp;<?php the_time('F j, Y'); ?></li>
    Thanks & Regards
    Pramod
     

Share This Page