The footer is a crucial part of every website. It’s where important information can be displayed, such as copyright notices, contact details, and links to your social media profiles. One key piece of information to include in your footer is the year. However, manually updating the year can be time-consuming—especially if your website has multiple pages. Fortunately, Elementor offers several ways to make the year in your footer dynamic, so it updates automatically every year.
In this article, we’ll explore three different methods to dynamically update the year in Elementor: by using a code snippet, a shortcode, and Elementor’s built-in dynamic settings.
1. Using a Code Snippet
One way to change and dynamically update the year in the Elementor footer is by using a code snippet. This method involves adding code to your website’s functions.php file. Follow the steps below:
Step 1;
Open the functions.php file of your website. You can access this file from your WordPress dashboard by navigating to Appearance > Theme File Editor > functions.php, or by using an FTP editor to go to your (child) theme folder and opening the functions.php file there. This file contains essential code for your theme and allows you to add or modify functionality. Make sure to create a backup of this file first, just in case something goes wrong.
Step 2;
Once you’re in the functions.php file, scroll to the bottom of the file. Paste the following code at the very end:
function update_footer_year($text) {
$text = str_replace('CURRENT_YEAR', date('Y'), $text);
return $text;
}
add_filter('wp_footer', 'update_footer_year');
By adding this snippet of code, you’re creating a function called update_footer_year
that replaces the current year in your text. The filter wp_footer
ensures that this function is applied only in the footer of your website.
Step 3;
To actually display the year, you need to call the function in your theme’s footer. This can vary depending on the theme you’re using. In general, you can follow these steps:
- Navigate to “Appearance” > “Theme File Editor” in your WordPress dashboard.
- Locate and open your
footer.php
theme’s footer.php file. - Add the following code to the
footer.php
file:
<?php echo update_footer_year('Copyright © CURRENT_YEAR website.com.'); ?>
This code calls the update_footer_year
function and replaces the text CURRENT_YEAR
with the current year. You can customize the text to display your own copyright information, but make sure to keep CURRENT_YEAR
in place — otherwise, the function won’t work.
Step 4;
To view the changes, save everything and then visit your website. Refresh the page and you’ll see that the year in the footer is now automatically updated to the current year.
However, some themes may require a different approach. Certain themes might generate or control the footer year in another way. In such cases, it’s recommended to consult your theme’s documentation or use one of the following options.
2. Using a Shortcode
Another way to change and dynamically update the year in the Elementor footer is by using a shortcode.
This is a very simple solution and also the quickest to implement. For this step, we’ll again modify the functions.php file by adding the following code:
Open yourfunctions.php
theme’s functions.php file. You can do this via the Theme Editor in your WordPress dashboard or by accessing your theme folder through FTP. Then, add the code below at the bottom of the functions.php file.
function current_year_shortcode() {
$year = date('Y');
return $year;
}
add_shortcode('current_year', 'current_year_shortcode');
When you now create a footer template in Elementor and add [current_year]
where you want the year to appear, the year will automatically update to the current year.
3. Using Elementor Dynamic Settings
Finally, you can also use Elementor’s dynamic settings to make the year in your footer dynamic. This is an option that not many people know about, but it’s incredibly handy and easy to use. Follow the steps below:
For convenience, I’m going to assume you’re familiar with Elementor and know how to create a footer template. Once your footer template is ready, follow the short instructions below and the year will automatically update from now on.
This third option is, in my opinion, the best choice if you’ve built your website using Elementor. It’s a lesser-known method, so I hope it’s helpful and that you’ll start using it from now on.
Conclusion
Updating the year in your website’s footer can be a time-consuming task, especially if you manage multiple client websites. Fortunately, Elementor offers several ways to make the year dynamic, so it updates automatically each year.
Today, we covered three different ways to update the year in your website’s footer and keep it automatically up to date.
The first option is manually adding a code snippet to your theme’s functions.php functions.php
file. While this is a slightly more technical approach, it gives you full control over how the year is displayed.
The second option is using a shortcode. I showed you how to add a handy piece of code to your functions.php file to create [current_year]
a shortcode called , which you can then insert into a text widget to automatically display the current year.
The third option uses Elementor Dynamic Settings. With this feature, you can display the year using a text element and apply dynamic settings to automatically update the year, including adding text before or after it.
Each option has its own advantages, and it’s up to you to decide which one best suits your needs and skills. Whatever you choose, the most important thing is that your website always displays an up-to-date year in the footer.
Let me know if you have any questions or show me your solution. Or maybe you’ve found another way? Share it with us!