How to 'not show published date' and only Updated?

  • Unknown's avatar

    Hi.

    I got serveral posts on my blog and its showing the following under the title.

    Written By: xxx – Published Xx:XX:Xx . Updated Xx-Xx-Xx

    I would like to remove the Published date and keep only the updated one when the difference is to big, for example, several weeks, hours or days.

    I got this code on my php that is doing the work. I dont know php code; could you help me?

    Thanks!

    $u_time = get_the_time('U'); 
    $u_modified_time = get_the_modified_time('U'); 
    if ($u_modified_time >= $u_time + 86400) { 
    echo "<p>Last modified on "; 
    the_modified_time('F jS, Y'); 
    echo " at "; 
    the_modified_time(); 
    echo "</p> "; } 
  • Unknown's avatar

    Sorry. WRONG CODE.

    The real one is this one:

              <?php if( get_the_modified_date() != get_the_date() || get_the_modified_time() != get_the_time() ) : ?>
    
                  <?php
                    $modified_date = get_the_modified_date( get_option('date_format') );
                    $machine_readable_modified_date = esc_attr( get_the_modified_date( 'c' ) );
                  ?>
                  <?php _e('Published', 'hueman'); ?> <time class="published" datetime="<?php echo $machine_readable_published_date; ?>"><?php echo $published_date; ?></time>
                  &middot; <?php _e('Updated', 'hueman'); ?> <time class="updated" datetime="<?php echo $machine_readable_modified_date; ?>"><?php echo $modified_date; ?></time>
              <?php else : ?>
                  <time class="published" datetime="<?php echo $machine_readable_published_date; ?>"><?php echo $published_date; ?></time>
              <?php endif; ?>
  • The topic ‘How to 'not show published date' and only Updated?’ is closed to new replies.