How do show date with year for blog post?
-
Hi,
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 š
-
This topic was modified 1 year, 3 months ago by
arif.
-
This topic was modified 1 year, 3 months ago by
arif. Reason: just a thanks in advance
Hi 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
Hi,
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, 2 months ago by
arif.
Hi 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,