Hi @nebadita,
What code are you using? Can you provide a link to your post?
Hi,
I am using the following code:
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">Last Updated On %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 );
Here is my post link
Try this:
add_filter( 'generate_post_date_output', function( $output, $time_string ) {
$time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">Published on %2$s</time>';
if ( get_the_date() !== get_the_modified_date() ) {
$time_string = '<time class="entry-date updated-date" datetime="%3$s" itemprop="dateModified">Updated: %4$s</time>
<time class="entry-date published" datetime="%1$s" itemprop="datePublished">Published: %2$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 );
Hi,
Thanks for the code. I have changed it. Still not showing.
For your reference, I have attached the screenshot below
https://prnt.sc/qIQHcK-NyR0N
Hi,
Thanks.. Now it is showing. But now the published and updated word is showing double double. For your reference, I have attached the screenshot below.
https://prnt.sc/k5RRwMP78nmi
And also why it is not displaying when I am activating generatepremium? Please let me know how can I able to display this on gp premium?
Hi there,
please share a link to your site, so we can see the issue.
And no we cannot tell you how to display this on GP Premium, as WordPress forbids us from providing support for premium plugins in this forum.
The issue you mention here i do not see on the link you provided.
hi,
please refresh the link once. You will able to see..
ying
(@yingscarlett)
The link you provided is using GP premium feature (block element – post meta template), it’s not the default GP template, so the code will not work. And the published on text is there before the date, I don’t see the issue you described.