- This topic has 5 replies, 2 voices, and was last updated 3 years, 8 months ago by
David.
-
AuthorPosts
-
October 24, 2019 at 12:08 am #1042989
Paul
Hi,
since I change to Generatepress, Google shows only the published date instead of the last modified date in SERPs. Is there any option to change this back to showing only the modified date?October 24, 2019 at 6:23 am #1043242David
StaffCustomer SupportHi there,
the snippet provided here will display only the Updated Date:
https://docs.generatepress.com/article/generate_post_date_output/#only-show-updated-date
May take google some recrawls to use the updated date.
October 28, 2019 at 2:51 am #1046486Paul
Thanks, but adding this, doesnt work with my other customizations:
I need to display it like this:
TITLE
by Paul Winkler (author name) 10.10.2019 (modified date)How can I combine both my own snippets and the snippet you mentioned in the last reply?
add_filter( 'generate_header_entry_meta_items', function() { return array( 'author', 'date' ); } ); add_filter( 'generate_post_author_output', function( $output ) { return '<i class="fa fa-user-circle" aria-hidden="true"></i> ' . $output; } ); add_filter( 'generate_post_date_output', function( $output, $time_string ) { printf( '<span class="posted-on">%s</span>', $time_string ); }, 10, 2 ); 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_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $time_string = '<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 );October 28, 2019 at 10:00 am #1046993Tom
Lead DeveloperLead DeveloperHi there,
Try removing this one:
add_filter( 'generate_post_date_output', function( $output, $time_string ) { printf( '<span class="posted-on">%s</span>', $time_string ); }, 10, 2 );July 7, 2022 at 7:44 am #2276060melonbird
What about the last modified date, as opposed to last updated date?
ETA: NM, I figured it out.
July 7, 2022 at 9:46 am #2276365David
StaffCustomer SupportGlad to hear that!
-
AuthorPosts
- You must be logged in to reply to this topic.