Site logo

[Support request] Post Date Displaying Multiple Places in Single Post

Home Forums Support [Support request] Post Date Displaying Multiple Places in Single Post

Home Forums Support Post Date Displaying Multiple Places in Single Post

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2599509
    Julie

    I added this snippet,

    add_filter( ‘generate_post_date_output’, function( $output, $time_string ) {
    $time_string = ‘<time class=”entry-date published” datetime=”%1$s” itemprop=”datePublished”>%2$s</time>’;

    if ( get_the_date() !== get_the_modified_date() ) {
    $time_string = ‘<time class=”entry-date published” datetime=”%1$s” itemprop=”datePublished”>Originally Posted %2$s</time> | <time class=”entry-date updated-date” datetime=”%3$s” itemprop=”dateModified”>Updated %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() )
    );

    return sprintf( ‘<span class=”posted-on”>%s</span> ‘,
    $time_string
    );
    }, 10, 2 );

    This is working great to display the original date and last updated date, but now my single posts have the original post date at the top, (just under the title of the blog post) AND right after the featured image.

    I can’t seem to locate how to remove the first date (under the post title). Any suggestions?

    #2599801
    David
    Staff
    Customer Support

    Hi there,

    when you view that page, check the Admin Bar > Elements menu. It will show you which GP Elements are on that page.
    Look for one called hero or header, and edit that, there you can remove the date if you want.
    Or you can add both dates in the editor ….

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.