Although it may seem unbelievable, there are a great many themes for WordPress, both free and premium, that do not generate the current year dynamically. This functionality is very useful for being able to add the year in force in the copyright of the footer, and in those themes in which it is not generated automatically thanks to a variable or to a shortcode native to the theme itself, one of these actions has to be taken:

Change the year in force at that moment in the options of the theme every year.

It is the simplest option of all, but also the most tedious and the least advisable, since the most likely thing is that you will remember some time in April that the year currently shown on your website is out of date.

Change the code of the footer.php template in the child theme.

This option is also simple, but it is going to force you to keep an eye on the successive updates of the parent theme in order to incorporate the code changes that are made to this file in future versions of the theme. That is why we do not recommend it to you either.

Customise the hook that generates the copyright by changing the filter or the action in charge of doing it.

You have to make this customisation in the functions.php file of the child theme and, although creating it is relatively simple, it requires knowing the hook that the author of the template in question has created to carry out this task, and having sufficient knowledge of PHP and of programming in WordPress. To achieve it you will first have to look for the hook in the PHP code that is in the footer.php template. Therefore, unless you are very clear about what you are looking for and what you are doing, we do not recommend this option to you under any circumstances.

Create our own shortcode in the functions.php file of the child theme.

We have left for last the simplest and the most advisable option of all the options proposed.

Solution

To achieve it we are going to create a shortcode thanks to a simple and tiny PHP function that we will add in the functions.php file of the child theme.

The PHP function we propose to you today is the following:

Copy to clipboard

Thanks to this incredibly simple piece of PHP code you will be able to add the current year anywhere on your website by writing this simple shortcode wherever you need it:

Copy to clipboard

This tiny piece of code must return this to you: 2026, the year in course at this moment. As you can see, in this simple and straightforward way you now have a solution for a problem that we still do not understand how it is not solved in 100% of themes. As always, we hope that the proposal we are making to you is useful and functional. Does your theme not have this functionality either? How have you solved it? We look forward to your comments and opinions on this post.

Related posts

Comments

Suscríbete
Notificar de
0 Comments
Más antiguos
Más recientes Más votados

In this post

Products and services

Latest posts

Latest comments

Subscribe!

Lista de correos de APG

DATA PROTECTION: In accordance with data protection regulations, we provide you with the following processing information: (+)

  • Responsible: Art Project Group.
  • Treatment purposes: to respond to queries or any type of request made by the user through any of the forms of contact that are made available on the website. Sending communications about products or services (with your consent).
  • Your rights: access, rectification, portability, deletion, limitation and opposition. More information about the treatment in the Privacy Policy.

What we post on !

Se ha publicado #WooCommerce 11.2.2: actualización de seguridad que refuerza las API REST y Store, mejora la validación de CSV y corrige problemas en pagos y pedidos. Incluye cambios en la base de datos.

¡Actualiza cuanto antes!

November 5, 2026