• Home
  • WordPress Themes
    • eCommerce
    • Corporate
    • Multipurpose
    • Blog
  • Support
    • WoodMart support
    • Basel support
    • Space support
    • Feature requests
  • Docs
    • WoodMart
    • Basel
    • Hitek, Luman, Antares
  • Image optimizerNew
Login / Register
Checkout
Checkout
Menu

Home / Forums / WoodMart support forum / add year in .post-date

Home › Forums › WoodMart support forum › add year in .post-date

add year in .post-date

  • This topic has 1 reply, 2 voices, and was last updated 4 years ago by Artem Temos.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • June 30, 2021 at 1:09 pm #303654

    ART
    Participant

    Hi,
    How can I add the year in header.entry-header .post-date?
    I’m attaching an example.
    thank you
    Art

    Attachments:
    You must be logged in to view attached files.
    July 1, 2021 at 6:13 am #303803

    Artem Temos
    Keymaster

    Hi,

    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

  • Author
    Posts

Tagged: post-date year

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to create new topics. Login / Register
Close

Your request can't be resolved for a long time? Contact our general support manager.

Contact form
WoodMart Image Optimizer
Create your WordPress website.
  • Resources
    • Video tutorials
    • Blog
    • Contact us
    • Refund Policy
    • Terms of Service
  • Social links
    • Facebook
    • Twitter
    • Instagram
    • YouTube
@ XTemos studio. 2025 WordPress development from 2015.

Privacy Policy

  • Home
  • WordPress Themes
    • eCommerce
    • Corporate
    • Multipurpose
    • Blog
  • Support
    • WoodMart support
    • Basel support
    • Space support
    • Feature requests
  • Docs
    • WoodMart
    • Basel
    • Hitek, Luman, Antares
  • Image optimizerNew
  • Login / Register
Sign in
Close

Lost your password?

No account yet?

Create an Account
Sidebar