- This topic has 21 replies, 6 voices, and was last updated 3 years, 10 months ago by
David.
-
AuthorPosts
-
January 31, 2018 at 9:09 pm #485024
Amit
In many results from Google, it’s visible that people are using Last modified date. I am also thinking of adding the same to my posts and pages as well. Pages as of now don’t display any dates so I require a separate code for displaying on pages and separate code for posts to display last modified date like this
https://www.coffeemakersadvisor.com/best-keurig-coffee-maker-reviews/
https://coffeemakerpicks.com/.One more thing, the front is also a page so don’t want to display date on the front page.
GeneratePress 2.0.2GP Premium 1.5.6January 31, 2018 at 11:26 pm #485093Tom
Lead DeveloperLead DeveloperYou can tell your posts to display the updated date like this: https://generatepress.com/forums/topic/post-updated-date/#post-470725
You can add the date to pages like this:
add_action( 'generate_after_entry_header', 'tu_page_meta' ); function tu_page_meta() { if ( is_singular( 'page' ) ) : ?> <div class="entry-meta"> <?php generate_posted_on(); ?> </div><!-- .entry-meta --> <?php endif; }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentFebruary 1, 2018 at 1:04 am #485131Amit
Into which file should I place this code?
February 1, 2018 at 1:06 am #485132Amit
And what if I want to display the Last updated date on pages only?
February 1, 2018 at 1:17 am #485140Amit
I used the code at https://generatepress.com/forums/topic/post-updated-date/#post-470725. It removed even the already appearing date.
February 1, 2018 at 8:57 am #485553Leo
StaffCustomer SupportTom’s code can be added like using one of the methods here: https://docs.generatepress.com/article/adding-php/
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/February 1, 2018 at 8:19 pm #486075Amit
I did added the code to the child theme in functions.php. The code didn’t worked but it removed the ‘published date’.
February 1, 2018 at 10:00 pm #486125Tom
Lead DeveloperLead DeveloperDid you remove the code from the site? I’m seeing the published date still.
Let me know ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentFebruary 2, 2018 at 12:38 am #486199Amit
Yes I removed as it didn’t worked!
Now I added again for your check.February 2, 2018 at 10:16 am #486594Tom
Lead DeveloperLead DeveloperAh, add this CSS:
.posted-on .updated { display: inline; }
As for pages, is this snippet added?: https://generatepress.com/forums/topic/how-to-display-last-updated-date-on-pages-and-posts/#post-485093
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentFebruary 2, 2018 at 8:29 pm #486895Amit
Yes, now it displays the date. One addon, I want to display ‘Last Modified’ before the date.
Also, where should I insert the above provided code for displaying date in pages.February 2, 2018 at 9:41 pm #486915Tom
Lead DeveloperLead DeveloperAdd this:
.posted-on .updated:before { content: "Last Updated: "; }
You should add the other code snippet the same as any other snippet: https://docs.generatepress.com/article/adding-php/
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentFebruary 2, 2018 at 10:17 pm #486939Amit
Works perfectly….thanks Tom for the quick support. One of my favorite theme so far….
February 2, 2018 at 10:22 pm #486940Tom
Lead DeveloperLead DeveloperYou’re very welcome! ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentFebruary 5, 2018 at 3:48 am #488236Amit
Hey Tom, how can I avoid displaying date on home page?
-
AuthorPosts
- You must be logged in to reply to this topic.