Archived topic
GeneratePress's Read Template - Post Meta Edit
3 replies · Started by KC on November 24, 2021
Hello,
I hope this message finds you all safe and well.
I have an issue that needs help... I've already tried all ways to do it myself but just can't figure out.
So I am using GeneratePress's Read template/theme.
I used the following code (in Snippet's plugin) to show the post's published date and edited date:
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">Published: %2$s</time> | <time class="entry-date updated-date" datetime="%3$s" itemprop="dateModified">Edited: %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 );
It works on generatepress default theme. But it doesn't work on Read template/theme.
It does show on subcatgeory pages, but not on single posts itself.
Can you help me?
Hi there,
the Read Sites uses a Block element titled: Blog Posts Headers
It can be found in Appearance > Elements, or whilst viewing a post you can check the Admin Bar > Elements menu to see it and any other elements applied to that page.
Edit that, and you can change the dynamic data options.
See the search results here for some of the Block element docs:
https://docs.generatepress.com/?s=block+element+-+
The Page Hero and Post Meta Template docs would be a good place to start.
Wow, that's awesome.
I am reading and experimenting it and it's so cool and fun.
Thank you so much!
Glad to be of help :)