- This topic has 14 replies, 5 voices, and was last updated 3 years, 2 months ago by
Fernando.
-
AuthorPosts
-
February 13, 2022 at 6:01 am #2116568
Kia
Hi GP Team,
I would like to display the publish dates on specific pages. is there a way I can add the date the page was published (like in a blog post) to just a handful of pages?
Many thanks.
February 13, 2022 at 8:39 am #2116840David
StaffCustomer SupportHi there,
where within the page do you want to show the date ?
February 13, 2022 at 11:04 am #2116950Kia
February 13, 2022 at 2:50 pm #2117116David
StaffCustomer SupportTry this:
1. Create a new Hook Element in Appearance > Elements:
https://docs.generatepress.com/article/hooks-element-overview/
2. Add this code to the Element text area:
<?php echo get_the_date(); ?>3. Set the hook to:
generate_after_entry_header4. Check the Execute PHP option
5. Set the Display Rule Locations to pages you want it to appear on:
February 13, 2022 at 3:30 pm #2117137Kia
Works a treat! Thank you so much! 👊
February 14, 2022 at 3:51 am #2117652David
StaffCustomer SupportGlad to hear that!
February 16, 2023 at 12:38 am #2535095Ravi Saive
how to add the text ‘Last Updated‘ to date and align it to the right side?
February 16, 2023 at 12:40 am #2535098Fernando Customer Support
Hi Ravi,
For reference, can you provide the a to where you want to add this text?
February 16, 2023 at 12:55 am #2535119Ravi Saive
I want to show the text ‘Last Updated’ with the date on specific pages on the right side…
Here is the screenshot – https://i.postimg.cc/vT7sYxDD/Screenshot-2023-02-16-13-24-48.pngv
February 16, 2023 at 1:09 am #2535129Fernando Customer Support
Can you share the link to that page?
If you want, you can also start a new topic so you can use the Private Information field.
February 16, 2023 at 1:13 am #2535139Ravi Saive
Here is the page link
February 16, 2023 at 1:22 am #2535153Derek
Keen to do the same. I would like a “date published” and a “date modified” at the tops of each post.
February 16, 2023 at 1:27 am #2535155Fernando Customer Support
Hi Derek,
Are you referring to Posts or Pages? This topic is for showing the publish date on pages. If it’s for posts, kindly open a new topic.
Ravi,
Change this code:
<?php echo get_the_date(); ?>to:
<?php echo 'Last Updated ' . get_the_date(); ?>February 16, 2023 at 1:43 am #2535174Ravi Saive
Thanks, i modified the code to align it right side:
<p style="text-align:right;"><?php echo '<strong>Last Updated:</strong> ' . get_the_date(); ?></p>February 16, 2023 at 1:44 am #2535175Fernando Customer Support
You’re welcome, Ravi!
-
AuthorPosts
- You must be logged in to reply to this topic.