# How to add year which changes dynamically in Woocommerce or WordPress

URL: https://sohaib.com/blog/how-to-add-year-which-changes-dynamically-in-woocommerce-or-wordpress
Author: Sohaib Khan
Published: Dec 30, 2019
Updated: Sep 8, 2026
Category: E-commerce Solutions

> You simply need to edit your functions.php. function yearshortcode() {<br> $year = date('Y');<br> return $year;<br> }<br> addshortcode('year', 'yearshortcode'); Now go to your Footer widget and add the shortcode or…

You simply need to edit your functions.php.

```javascript
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](https://css-tricks.com/snippets/wordpress/year-shortcode/)
