Back to Blog

How to add year which changes dynamically in Woocommerce or WordPress

December 30, 20191 min read0 comments

You simply need to edit your functions.php.

function year_shortcode() {<br>
  $year = date('Y');<br>
  return $year;<br>
}<br>
add_shortcode('year', 'year_shortcode');

Now go to your Footer widget and add the shortcode or where ever you wanted to add the YEAR for example 2020 by using

 

Special Thanks to CSS-Tricks

Enjoyed this article?

Show your appreciation with a clap

0claps
Share this article
SK
Written by

Sohaib Khan

View all posts

You might also like

View all

Comments (0)

No comments yet. Be the first to comment!