• Resolved Walter Pinem

    (@walterpinem)


    Hello there guys. I’m building a custom theme using Underscores Components. After posting a content to start designing the layout, the post date displayed double like this:

    screenshot

    I checked the template tags that handle the post date, and here’s what I found:

    $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() )
            );

    which one should I delete and which one should stay?
    Thank you very much before.

Viewing 2 replies - 1 through 2 (of 2 total)
  • By default, Underscores displays both the date a blog post was published and the date the post was last updated, if they differ. (A theme author could style the dates differently by targeting the “published” and “updated” classes if they so chose.)

    You could delete the two lines that refer to get_the_modified_date() in the snippet that you posted and you’ll also want to delete these lines as well:

    if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
      $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
    }
    Thread Starter Walter Pinem

    (@walterpinem)

    That worked perfectly.
    Thank you very much 😀

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Post date displayed double using Underscores Components Theme Starter’ is closed to new replies.