-
chetanpatil
Hi,
On my post : http://ruminatee.com/personal-finance-added-to-california-high-school-graduation-requirements/ I am trying ti display the published date and modified date as well. I can see the published date but modified date and modified only both are not working. It displays a number: https://prnt.sc/1WIuW_WW8Z67
I have modified this post and it has this date.
My settings are https://prnt.sc/cYAX4fp4yH_c
I have followed this article as well: https://learn.generatepress.com/blocks/dynamic-tags/post-date/
Nothing is working.Please let me know how we can fix this.
Regards
-
Alvind
Hi there,
The issue is with the Date Format where you’ve used “g” as the return format. The “g” format specifier represents the 12-hour clock without leading zeros (1 to 12). This is why the output shows only a single digit for the hour.
You can leave the Date Format field blank to use the default date format.
-
chetanpatil
Ok.
How we can make this block conditionally visible?
Means if there is a update date then only this block should appear otherwise should not. -
1. add a class to the published date, eg.
published-date
.
Adding CSS class(es): https://wordpress.com/support/wordpress-editor/adding-additional-css-classes-to-blocks/2. add a class to the updated date, eg.
updated-date
.
Adding CSS class(es): https://wordpress.com/support/wordpress-editor/adding-additional-css-classes-to-blocks/3. add a class to the parent container of the 2 text block, eg.
post-meta-container
.
Adding CSS class(es): https://wordpress.com/support/wordpress-editor/adding-additional-css-classes-to-blocks/4. add this CSS:
.post-meta-container:has(.updated-date) >.published-date { display:none; }
Adding CSS: https://docs.generatepress.com/article/adding-css/
Let me know if this helps!
-
chetanpatil
Ok Thanks. Can you tell me why the below post is showing the published date and updated date as same?
http://ruminatee.com/true-grit-rated-pg-13-for-western-style-justice-violence-and-characters-with-bad-teeth-and-slobber/Regards
-
Alvind
That means the post hasn’t been modified since it was originally published. Try editing the post and making a small change to confirm this.
-
chetanpatil
Ok I understand what you are saying but if the post is published and not modified then second block should be automatically hidden. This is weird.
Isn’t it? -
You need to select modified only instead of
modified
for the modified date, otherwise it will show the post date if no modified date.
https://app.screencast.com/fybN0TgmNUJRI
- You must be logged in to reply to this topic.