• Resolved Hemant Mendiratta

    (@hemant-mendiratta)


    Hi,

    I have figured out the code which I have to modify to get Last Updated instead of Published date for blog posts. But on trying many things I am not able to get the Last Modified date. Here is the code of my theme

    $time_string = ‘<time class=”entry-date published” datetime=”%1$s”>%2$s</time>’;
    if ( get_the_time( ‘U’ ) !== get_the_modified_time( ‘U’ ) ) {
    $time_string .= ‘<time class=”updated” datetime=”%3$s”>%4$s</time>’;
    }

    $time_string = sprintf( $time_string,
    esc_attr( get_the_date( ‘c’ ) ),
    esc_html( get_the_date() ),
    esc_attr( get_the_modified_date( ‘c’ ) ),
    esc_html( get_the_modified_date() )
    );

    $posted_on = sprintf(
    _x( ‘Posted on %s’, ‘post date’, ‘magnet’ ),
    ‘ . $time_string . ‘
    );

    Please, let me know what to modify in this code to get the last updated date of post.
    Post page :Track WhatsApp calls
    Thanks in advance!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    Hi Hemant Mendiratta

    The theme’s css is hiding the elements with the .updated class.

    .byline, .updated {
        display: none;
    }

    Try renaming it to something else like modified.

    Thread Starter Hemant Mendiratta

    (@hemant-mendiratta)

    Thank You so much. It worked like a charm.

    I changed the updated date class name to something else and didn’t concat the published date with that.

    Earlier I tried to make it visible through but wasn’t working.

    Thank You again.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to get the Last Updated date rather than Published date of post’ is closed to new replies.