How to add year which changes dynamically in Woocommerce or WordPress

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

 [year]

Special Thanks to CSS-Tricks

Leave a Reply

Your email address will not be published.