[Resolved] Date not updating in Google

Home Forums Support [Resolved] Date not updating in Google

Home Forums Support Date not updating in Google

Viewing 8 posts - 16 through 23 (of 23 total)
  • Author
    Posts
  • #1308177
    Tom
    Lead Developer
    Lead Developer

    Now change your date filter to this:

    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>';
    
        $updated_time = get_the_modified_time( 'U' );
        $published_time = get_the_time( 'U' ) + 86400;
    
        if ( $updated_time > $published_time ) {
            $time_string = 'Updated <time class="entry-date updated-date" 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">%s</span> ',
            $time_string
        );
    }, 10, 2 );
    #1308180
    Tibs

    Ok, so here are how my current snippets look like:

    Only Show Updated Date: http://prntscr.com/sqvali
    Author/Date: http://prntscr.com/sqvase
    Custom CSS: http://prntscr.com/sqvayi

    Did I get that right?

    If so, any way I can add a separator between author and date: http://prntscr.com/sqvba2?

    #1308992
    Tom
    Lead Developer
    Lead Developer

    Looks good! Try this CSS:

    .entry-header .entry-meta > *:not(:last-child):after {
        content: " | ";
    }
    #1309218
    Tibs

    That worked πŸ™‚

    I’ll keep an eye out for the date on Google and will let you know if it worked. Thanks again Tom!

    #1310064
    Tom
    Lead Developer
    Lead Developer

    No problem πŸ™‚

    #1313437
    Tibs

    The date updates in Google!

    Thanks Tom! You’re the man πŸ™‚

    (Just out of curiosity, what plugin would you recommend for Schema Markup? Star rating, review box, product details, etc.)

    #1314511
    Tom
    Lead Developer
    Lead Developer

    I don’t really have a go-to one. I would suggest going the JSON-LD route vs. HTML. There should be a lot of options out there if you search “WordPress JSON-LD” πŸ™‚

    #1314896
    Tibs

    Will do, thanks!

Viewing 8 posts - 16 through 23 (of 23 total)
  • You must be logged in to reply to this topic.