Do you want the text Copyright © 2018 to be updated to the current year automatically in your WordPress footer? It can be done with a shortcode –  without plugins. We’ll also bring you a few bonus date formats like current date, current month and current day.

Watch the video (coming soon) or follow the instructions below if you prefer to read. All code snippets you’ll need are available for copy & paste in the article. This works with most themes for WordPress, so you don’t have to use Divi from Elegant Themes.

Related content: Display the current year automatically in the Divi Bottom Bar

Step 1. Allow shortcodes in WordPress widgets

A shortcode is a small code snippet that displays dynamic information, such as today’s date. A shortcode consists of a word within hooks, eg. [year] which, if correctly implemented, automatically displays 2018 – and gets updated automatically at the same time as the New Year Eve’s fireworks is taking off.

WordPress standard is that your footer (and sidebar) consists of widgets . Unfortunately, WordPress default settings does not support shortcodes in widgets; instead, it will only display shortcodes as plain text – (eg [year] – when you publish.

But luckily you can change that with a few lines of code in functions.php . If you do not have a child theme , you should get one first . Otherwise, your code will be overwritten next time you update your theme.

Start in your WordPress dashboard and go to Appearance Editor. Then select functions.php in your child theme and enter the following code at the end (before the closing line with ?>).

 //Allow shortcodes in widgets
add_filter ('widget_text', 'do_shortcode');

Bonus! All the shortcodes described in this article can also be used in the body copy in your WordPress pages and posts.

2. Create your shortcode for the current year (and current month, current date or current day)

Next step is to create one or more shortcodes that display today’s date. Copy the code below for the date formats you want to use and paste it in your  functions.php. You can place the code below the code you added in the previous step – always above the ending  ?>Save.

Code in functions.php Short Code Result
//Display current year
function year_shortcode () {

$ year = date_i18n (‘Y’);
return $ year;
}
add_shortcode (‘year’, ‘year_shortcode’);
[year] 2018
//Display current month
function monthyear_shortcode () {
$ monthyear = date_i18n (‘F Y’);
return $ monthyear;
}
add_shortcode (‘monthyear’, ‘monthyear_shortcode’);
[month] November
//Display current date as YYYY-MM-DD
function yyyymmdd_shortcode () {
$ yyyymmdd = date_i18n (‘y-m-d’); return $ yyyymmdd;
}
add_shortcode (‘yyyymmdd’, ‘yyyymmdd_shortcode’);
[yyyymmdd] 2018-11-19
//Display current month and year
function monthyear_shortcode () {

$ monthyear = date_i18n (‘F Y’);
return $ monthyear;
}
add_shortcode (‘monthyear’, ‘monthyear_shortcode’);
[monthyear] November 2018
//Display current day
function day_shortcode () {

$ day = date_i18n (‘F Y’);
return $ day;
}
add_shortcode (‘day’, ‘day_shortcode’);
[day] Monday

It should look something like this if you’ve entered all the code above:

Todays date in functions.php

Bonus! Do you want even more date formats to choose from? Here’s the complete date formats list.

Change language for current date

Do you want another language format for the current date? To change the language, just go to your WordPress dashboard and choose  Settings and change Site Language to desired language. This  will automatically refresh the date displayed from your shortcodes (for all code ninjas out there: this works since we are using date_i18n instead of just date in functions.php).

Change language in WordPress settings Change language settings and date default format in WordPress.

 

3. Add “Copyright © 2018 Company Name. All rights reserved.” in your footer

Now we are done with the coding. Time to insert the current year shortcode into your footer. Go to Appearance> Widgets. Grab a Text Block and drop it on, for example, Footer Area # 1. In the text field, paste:

Copyright © [year] Company Name. All rights reserved.

Replace Company Name to your desired company name and save.

Add current year shortcode to the WordPress footer

You can also try to add the other shortcodes [month], [yyyymmdd], [monthyear] and [day] in the footer widgets. The result should look something like this (yes, I did this on a Sunday):

Wordpress footer with automatic current date

That’s all for now. Good luck!

Next step: Dynamic Content is the Future

If you are using the  Divi theme, you may know that Elegant Themes, recently launched the awesome feature  Dynamic Content. This means that you do not need to use shortcodes to embed dynamic content such as a Featured Image, Page Ritle, Author or – current date or year. But this only works when using Divis Visual Builder on pages, posts and custom post types.

Elegant Themes has announced an upcoming update that enables the Divi Visual Builder in the footer, but while waiting for this update, shortcodes are our best option.

Divi Dynamic Content

Dynamic content for Divi makes it easier then ever to display dynamic content on pages and posts. Coming soon to the WordPress footer?

Read more about Divi Dynamic Content

More from the blog

Create A Bouncing Scroll Down Icon In WordPress

Hero sections with full screen images are a beautiful web design trend but it will hide your website content under the fold and force the visitor to scroll in order to discover the rest of your page. Why not help them with a bouncing scroll-down icon that is...

How to get 20% off the Divi theme – without a discount code

Divi is one of the world's most used and highly rated premium themes for Wordpress. Through DiviMundo you will get a 20% discount on your Divi membership at Elegant Themes – without using a discount code, promo code or discount coupon. Let's go! Get your discount with...

Add Copyright © Year in the WordPress Footer with Automatic Updates

Add Copyright © 2018 that is updated to current year automatically in your WordPress footer. Add current year, date or day with shortcodes without a plugin.

Display © Current Year Automatically in the Divi Bottom Bar

The Divis Bottom Bar below the WordPress footer fits perfect for Copyright © information. Create an automatic feature that always displays the current year.

Black Friday 2018 Is Coming

Don't miss the upcoming Black Friday campaign from Elegant Themes. Sign up for the newsletter and add the date yo your calendar, because this is going to be the biggest sale yet.  As if the sale wasn't big enought, you do also have the chance to win a brand new iMac...

Top 5 Free Plugins For Divi – Download Today!

When you install Divi you'll get 46 powerful modules, such as Number Counters, Maps and Sliders. But sometimes your design requires additional resources. Luckily, there are a bunch of good plugins developed specifically for Divi. Here is a list of the top five free...

3 easy ways to make a logo (if you’re not a graphic designer)

Professional graphic designers often make their logotypes in complex applications from Adobe CC, like Illustrator, Photoshop and Indesign. But all the advanced features tend exhaust beginners that just wants to create a nice logo in short time. Here are three ways to...

Fantastic facts & statistics about WordPress 2018

Almost one out of three websites in the world is created with Wordpress. In addition to the user-friendly interface and the fact that Wordpress is free, the open source approach is a popular reason to choose Wordpress. Thousands of developers worldwide improve the...

Create Round Images In WordPress (Without Photoshop)

Round images are often used for making the web design feel less sharp and more dynamic. It's common to use round pictures on websites with portrait images in Contact Us pages and for Product pages. Here's a tutorial on how to transform images from square to round in...