Site logo

Archived topic

Dumbass here - space disappeared "Updated: June 20, 2019by Clare"

3 replies · Started by Clare on June 20, 2019

Viewing posts 1–4 of 4

Hey guys,

i've been rooting around CSS or snippets and trying to figure out why my updated date has started to appear as above, with no space between '2019' and 'by'. I'm sure this is something dumb I haven't figured out, it only started today it seems.

Thank you in advance for any help and apologies if I'm really being dumb :)

I'm using this snippet:

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

    if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
        $time_string = '<time class="updated" datetime="%3$s" itemprop="dateModified">%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">%1$s</span>', // WPCS: XSS ok, sanitization ok.
        sprintf( '<a href="%1$s" title="%2$s" rel="bookmark">%3$s</a>',
            esc_url( get_permalink() ),
            esc_attr( get_the_time() ),
            $time_string
        )
    );
} ); 

and this CSS:
.posted-on .updated {
display: inline-block;
}

.posted-on .updated:before {
content: "Updated: ";
}
time.entry-date.published {
display: none;
}

YAY!! Easy when you know how :) thank you so much for the quick reply.. Really appreciate it.
Clare

No problem :)

This archived topic is closed to new replies.