Home Forums WoodMart support forum Add year to blog posts

Add year to blog posts

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #531709

    Pernilla
    Participant

    I have earlier asked for a function to add year to the blog post. You can see in this topic created by me:
    https://xtemos.com/forums/topic/add-year-to-blog-posts/
    I am trying to add the same on a new page but it does not work. Can you see why?
    Thanks

    #532112

    Hello,

    Your issue has been resolved. I have added the php code in the fucntion.php of the theme. It is working fine. Check back your site after completely clearing the browser cache.

    Here is the code:

    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
    }

    Best Regards.

    #532116

    Pernilla
    Participant

    So kind of you! Looks perfect!
    Thank you!

    #532141

    Most Welcome!!!.

    I’m so happy to hear you are pleased with the Theme and Support. XTEMOS strives to deliver the best customer experience, and it makes our day to hear we have accomplished that.

    We count ourselves lucky to have you as a customer. You can always reach us at any time. We are always here to help you.

    Thanks for contacting us.
    Have a great day.

    Topic Closed.
    Best Regards.

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Add year to blog posts’ is closed to new replies.