Home › Forums › WoodMart support forum › How do show date with year for blog post?
How do show date with year for blog post?
- This topic has 3 replies, 2 voices, and was last updated 1 year, 6 months ago by
Hung Pham.
-
AuthorPosts
-
May 5, 2024 at 8:35 pm #563347
arifParticipantHi,
As per stated in the title above, are there any ways so that it also show Year instead of just Day & Month for blog posts?
Please refer the attached image.
Thanks in advance for your assistance š
May 6, 2024 at 10:56 am #563473
Hung PhamParticipantHi arif,
Thanks for reaching to us.
Try to add the following PHP code snippet to the child theme functions.php file to do this
function woodmart_post_date( $args ) { $has_title = get_the_title() != ''; $attr = ''; if ( ! $has_title && ! is_single() ) { $url = get_the_permalink(); $attr = 'window.location=\'' . $url . '\';'; } $classes = ''; $classes .= ' ' . $args['style']; $classes .= woodmart_get_old_classes( ' woodmart-post-date' ); ?> <div class="post-date wd-post-date<?php echo esc_attr( $classes ); ?>" onclick="<?php echo esc_attr( $attr ); ?>"> <span class="post-date-day"> <?php echo get_the_time( 'd' ); ?> </span> <span class="post-date-month"> <?php echo get_the_time( 'M' ); ?> </span> <span class="post-date-year"> <?php echo get_the_time( 'Y' ); ?> </span> </div> <?php }Kind Regards
May 13, 2024 at 9:29 am #565079
arifParticipantHi,
I’ve pasted your code into my child theme’s functions.php, however it doesn’t seems to work like I wanted to.

Are you sure this code is working?-
This reply was modified 1 year, 6 months ago by
arif.
May 14, 2024 at 8:05 am #565348
Hung PhamParticipantHi arif,
First of all, Iām really sorry have taken long time to reply you due to the weekend.
To assist you in the best possible manner, I kindly ask that you please provide me temporary wp-admin info (wp-admin URL, username, password) and screenshots that illustrate the problem to the Private Content area, this will allow me to thoroughly investigate and address your concerns more efficiently.
Regards,
-
This reply was modified 1 year, 6 months ago by
-
AuthorPosts
Tagged: blog, Blog Post, date, date with year
- You must be logged in to create new topics. Login / Register
