• Hello,

    I have two questions about displaying dates in posts.

    1) Is it possible/how do I display the original publish date and the updated date of a post? (probably a great idea for developers to create if it does not exist already)

    2) How do I show either the original publish date OR the updated date? I notice the updated date shows by default. (is there a way to toggle)?

    I appreciate your help. Good cheer to you
    FT

Viewing 1 replies (of 1 total)
  • Theme Author Organic Themes

    (@organicthemes)

    Hello,

    Within the loop-post.php file you could edit the following code:

    <?php if ( get_the_modified_time() != get_the_time() ) { ?>
      <?php esc_html_e( 'Updated on', 'swell-lite' ); ?> <?php the_modified_date( esc_html__( 'F j, Y', 'swell-lite' ) ); ?>
    <?php } else { ?>
      <?php esc_html_e( 'Posted on', 'swell-lite' ); ?> <?php the_time( esc_html__( 'F j, Y', 'swell-lite' ) ); ?>
    <?php } ?>

    Change it to this to show both:

    <?php esc_html_e( 'Posted on', 'swell-lite' ); ?> <?php the_time( esc_html__( 'F j, Y', 'swell-lite' ) ); ?> &middot; 
    <?php esc_html_e( 'Updated on', 'swell-lite' ); ?> <?php the_modified_date( esc_html__( 'F j, Y', 'swell-lite' ) ); ?>

    This to show only the original publish date:

    <?php esc_html_e( 'Posted on', 'swell-lite' ); ?> <?php the_time( esc_html__( 'F j, Y', 'swell-lite' ) ); ?>

    And this to show only the updated date:

    <?php esc_html_e( 'Updated on', 'swell-lite' ); ?> <?php the_modified_date( esc_html__( 'F j, Y', 'swell-lite' ) ); ?>

    I hope this helps!

Viewing 1 replies (of 1 total)
  • The topic ‘How to show original publish date and updated date?’ is closed to new replies.