- This topic has 23 replies, 4 voices, and was last updated 3 years, 12 months ago by Tom.
-
AuthorPosts
-
April 26, 2020 at 7:27 am #1256338Fekry
Hi there
I’ve put this below filter in Snippet plugin to (Show last update date on posts and google results), but updated word shows in every post I publish, not only in the updated ones as I wish.
May you show me what I should do ?
Thanks
…………………………..
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”>updated: %s</span> ‘,
$time_string
);
}, 10, 2 );April 26, 2020 at 10:24 am #1256705LeoStaffCustomer SupportHi there,
Try this CSS:
https://docs.generatepress.com/article/show-the-updated-post-date/April 26, 2020 at 11:24 am #1256772FekryHi Leo.
that is not working? Word (last updated) shows in the post which I just published and I did not modified it.
May you check the “URL” link please?April 26, 2020 at 12:40 pm #1256838LeoStaffCustomer SupportCan you disable the coming soon page?
Are we referring to what is displayed or the source?
April 26, 2020 at 1:02 pm #1256857FekryI disabled the coming soon page. You can have a look now.
April 26, 2020 at 2:51 pm #1256933Fekryleo, I am waiting your help and do not want to disable the coming soon page for long time, my site is not ready yet.
April 26, 2020 at 4:20 pm #1256994TomLead DeveloperLead DeveloperHi there,
Can you try the updated function here?: https://docs.generatepress.com/article/generate_post_date_output/#only-show-updated-date
Let me know 🙂
April 26, 2020 at 4:56 pm #1257015FekryHi Tom.
this filter also shows updated word in all posts (updated and just published) and remove the date.
I’ve put a new URL link in the orginal message for a fake post I just published.
I need word “updated” to show only in the really updated posts.
What should I do?April 26, 2020 at 5:02 pm #1257022TomLead DeveloperLead DeveloperThat code shouldn’t actually include any “updated” or “published” words – was going to add those using CSS after.
Can you make sure you’re not using any other filters/custom functions?
April 26, 2020 at 5:07 pm #1257024FekryOk Tom. It was my fault. Now there is now “updated” word. What should do next (CSS)?
April 26, 2020 at 5:10 pm #1257025TomLead DeveloperLead DeveloperHere you go:
.updated-date:before { content: "Updated on "; } .published:before { content: "Published on "; }
April 26, 2020 at 5:14 pm #1257032FekryI’ve modified the post, but nothing shows in the meta line! I need to show “updated” word.
April 26, 2020 at 6:00 pm #1257055FekryHello Tom..
April 27, 2020 at 3:23 am #1257446DavidStaffCustomer SupportHi there,
can you remove the coming soon so we can take a look
April 27, 2020 at 6:20 am #1257694FekrySure. May you check it please.
-
AuthorPosts
- You must be logged in to reply to this topic.