Welcome to WebSensePro! In this tutorial, we’re tackling a common challenge faced by website owners as we step into 2024 – the need to update copyright dates across multiple WordPress websites. But fear not, we’ve got a clever solution that will save you time and effort. Follow along for a step-by-step guide.
Step 1: Code Implementation in Functions.php
To implement this time-saving solution, we’ll add a PHP code snippet to the functions.php file. Adding it to the child theme instead of the parent theme to prevent code loss during theme updates is crucial.
Step 2: Creating a Child Theme
Follow our tutorial to create a child theme using an online tool. This ensures that your custom code remains intact during parent theme updates, as a protective layer for worry-free maintenance.
Step 3: Practical Demonstration
With the child theme in place, we’ll navigate to the theme file editor and insert the code snippet into functions.php. The video demonstrates this process using the Hello Elementor theme, but the technique applies to any WordPress theme.
Step 4: Universal Applicability
Whether you prefer Elementor or any other builder, this tutorial is designed to work universally across all themes and builders within the WordPress ecosystem. We’ll showcase how to integrate the dynamic copyright date into Elementor using a shortcode widget.
Add the following code in Functions.php(Child Theme)
function year_websensepro_function () {
$year = date_i18n ('Y');
return $year;
}
add_shortcode ('year', 'year_websensepro_function');
Now place the following Shortcode anywhere in the website:
[year]