How to Display the Current Year in WordPress With a Shortcode. OverviewMost websites have the copyright and year displayed in the footer. When I come across a website with an old year, it makes me question if the information on the website is out of date. This tutorial will explain how to allow the use of shortcodes in your widgets and then how to create the shortcode that will dynamically display the current year in your footer.Quickies.How to Allow the Use of Shortcodes in WordPress Widgets and Footer.How to Display the Current Year in WordPress with a Shortcode.What is a WordPress Shortcode?A shortcode is a bit of text between two square brackets that when added to a post, page or widget will execute a piece of PHP code. In-depth tutorial here: How to Make a Custom Shortcode in WordPress.How to Allow the Use of Shortcodes in WordPress Widgets and Footer.By default, WordPress does not support shortcode use in widgets. There is a simple way to get around this by adding a single line of code to your functions.php file. If you are editing the functions.php file, make sure you are using a child theme. More info on child themes: How to Make a WordPress Child Theme. There are a couple of ways to edit the functions.php file, you can make an FTP connection or do it directly in the WordPress backend. If you want to use FTP, see these instructions: How to Make an FTP Connection with FileZilla.How to Edit the functions.php File in the WordPress Backend.Login to the WordPress website admin area.In the left sidebar go to Appearance > Theme Editor.In the upper right hand corner, make sure you are editing the child theme, not the main theme.In the right sidebar select the functions.php file.Add the following piece of code to the file.add_filter ('widget_text', 'do_shortcode');Save or Update the file.Now you can use WordPress shortcodes in your widgets.How to Display the Current Year Dynamically with a Shortcode.In order to write our shortcode, we need to access the functions.php file. As stated above, there are a couple of ways to edit the functions.php file, you can make an FTP connection or do it directly in the WordPress backend. If you want to use FTP, see these instructions: How to Make an FTP Connection with FileZilla.How to Edit the functions.php File in the WordPress Backend.Login to the WordPress website admin area.In the left sidebar go to Appearance > Theme Editor.In the upper right hand corner, make sure you are editing the child theme, not the main theme.In the right sidebar select the functions.php file.Add the following piece of code to the file.function display_year() { $year = date('Y'); return $year; } add_shortcode('year', 'display_year');Save or Update the file.Now you can use the shortcode [year] in your WordPress widgets. Additional Posts. WordPressHow to Install a WordPress Theme.Read More WordPressHow to Make My WordPress Site Faster.Read More Web DevelopmentHow to Update the PHP Version in cPanel.Read More