- This topic has 6 replies, 2 voices, and was last updated 3 years, 10 months ago by Andrew Misplon.
- AuthorPosts
- December 28, 2020 at 4:26 pm #15263
GoungstarParticipantHi,
Thanks for the brilliant work done with Puro! 🙂 I’d like to display the last updated date of the posts instead of the published date.
I tried to follow some tutorials like this one. But it seems that the way Puro is coded isn’t the same as other themes.
How could I replace the published date with the updated date?
December 28, 2020 at 4:41 pm #15264
Andrew MisplonKeymasterHi, thanks for reaching out.
Are you using the Puro theme as seen in this demo? https://demo.purothemes.com/puro/
December 28, 2020 at 4:53 pm #15265
GoungstarParticipantThanks for the quick response, Andrew!
Yes. I didn’t change anything except for the fact that the homepage is a page, not the blog. 🙂
December 29, 2020 at 5:11 pm #15273
GoungstarParticipantI tried to change the function.php. But it didn’t work. :/
Is there a small tweak I can do in order to have the updated date instead of the published one?
December 30, 2020 at 12:54 pm #15275
Andrew MisplonKeymasterThanks
You can find a child theme for Puro here https://purothemes.com/documentation/puro-theme/child-theme-library/.
Here is how to migrate settings from the parent to the child theme https://purothemes.com/customizer-settings-export-import/.
Once your child theme is installed and activated you can try inserting the following into the child theme functions.php file:
if ( ! function_exists( 'puro_posted_on' ) ) : /** * Prints HTML with meta information for the current post-date/time, author, comment count and categories. */ function puro_posted_on() { if ( is_sticky() && is_home() && ! is_paged() ) { echo '<span class="featured-post">' . __( 'Sticky', 'puro' ) . '</span>'; } if ( is_home() && siteorigin_setting( 'blog_post_date' ) || is_archive() && siteorigin_setting( 'blog_post_date' ) || is_search() && siteorigin_setting( 'blog_post_date' ) ) { echo '<span class="entry-date"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark"><time class="published" datetime="' . esc_attr( get_the_date( 'c' ) ) . '">' . esc_html( get_the_modified_date() ) . '</time><time class="updated" datetime="' . esc_attr( get_the_modified_date( 'c' ) ) . '">' . esc_html( get_the_modified_date() ) . '</time></span></a>'; } if ( is_single() && siteorigin_setting( 'blog_post_date' ) ) { echo '<span class="entry-date"><time class="published" datetime="' . esc_attr( get_the_date( 'c' ) ) . '">' . esc_html( get_the_modified_date() ) . '</time><time class="updated" datetime="' . esc_attr( get_the_modified_date( 'c' ) ) . '">' . esc_html( get_the_modified_date() ) . '</time></span>'; } if ( siteorigin_setting( 'blog_post_author' ) ) { echo '<span class="byline"><span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '" rel="author">' . esc_html( get_the_author() ) . '</a></span></span>'; } if ( has_category() && siteorigin_setting( 'blog_post_cats' ) ) { echo '<span class="cat-links">' . get_the_category_list( __( ', ', 'puro' ) ) . '</span>'; } if ( has_tag() && siteorigin_setting( 'blog_post_tags' ) ) { echo '<span class="tags-links">' . get_the_tag_list( '', __( ', ', 'puro' ) ) . '</span>'; } if ( comments_open() && siteorigin_setting( 'blog_post_comment_count' ) ) { echo '<span class="comments-link">'; comments_popup_link( __( 'Leave a comment', 'puro' ), __( '1 Comment', 'puro' ), __( '% Comments', 'puro' ) ); echo '</span>'; } } endif;
December 30, 2020 at 3:29 pm #15277
GoungstarParticipantIt works!! Thanks a lot, Andrew for the clear tuto. 🙂
Puro is one of the best blogging themes I found.
December 30, 2020 at 3:51 pm #15278
Andrew MisplonKeymasterSuper, glad to hear you’re making progress 🙂
- AuthorPosts
The topic ‘Last Updated Date of The Posts’ is closed to new replies.