Site logo

Archived topic

Updated date not showing after CSS added

3 replies · Started by Jessica on December 3, 2022

Viewing posts 1–4 of 4

Hi! I'm wondering if it's possible for both (1) a post's updated date to be exclusively present in the html; and (2) both the original published date and the updated date to be visible at the top of every post.

I first tried adding this CSS & clearing my server's cache, with zero results on my site:

/* Display updated date */
.posted-on .updated {
display: inline-block;
margin-right: 1em;
}
/*Add date prefixes */
.posted-on .updated:before {
content: 'Updated: ';
}
.posted-on .entry-date:before {
content: 'Published: ';
}

(I do have header elements running, for Google Analytics and Google Tag Manager click-thru tracking; would that possibly interfere?)

After that, I found the filter generate_post_date_show_updated_only for hiding the published date in the html, which worked well to show only the updated date in each post.

Let me know if I might be able to add some other code to get both dates visible in my posts;
Thanks so much for the fantastic support!!!

Hi there,

i am a little confuse ( which is quite common for me lol ).
As you cannot show both dates ( published and updated ) on the front end, but only have the updated date in the HTML. For them both to be visible they both have to be in the HTML.
Are you wanting both dates to be visible on your site, but have google always use the updated?

Ha, thanks for the humor.

"Are you wanting both dates to be visible on your site, but have google always use the updated?"

That was my original idea;

But after some research, I think it's optimal to prioritize the updated date for SEO purposes; to make sure each post is appearing fresh, and only update when I have substantive changes.

And I assume it's simpler; that's not gonna involve some complicated work-around to try to make Google not show the publish date in serps.

Thank you! Now I'm just curious why I can't get other CSS to work to change a WP table header color; will open a new thread about that!

This archived topic is closed to new replies.