Display © Current Year Automatically in the Divi Bottom Bar

✏️ 2018-11-12 | Divi, Divi Nuggets, Wordpress | 11 comments

Since the release of Divi 4 you can build footers with the Theme Builder and add current year with the Dynamic Content feature. But if you still use the default Divi 3 footer, the method described in this post still works perfect.
Skribent: Victor Duse
By Victor Duse

The Divi Bottom Bar, located just below the WordPress footer, is a perfect place for Copyright © 2020 information. But a forgotten old year will give your website an outdated, dusty aura. So why not create an automatic feature that keeps the year fresh for you – year after year? Just follow the step-by-step guide below and stop worrying about outdated WordPress footers.

Watch the video (coming soon) or just follow the instructions below if you prefer to read. All the code snippets you’ll need is available for copy & paste in the article. You’ll need the Divi Theme from Elegant Themes but no extra plugins.

Related content: Display current date or year in the WordPress default footer

Step 1. Update functions.php

If you don’t have a child theme, now is the time to get one . Otherwise, your changes will be overwritten next time your theme is updated.

Start in your WordPress dashboard and go to Appearance > Editor. Then select functions.php in your child theme and paste the following code in the end. Save.

// Display current year 
function year_shortcode() {
$year = date_i18n('Y');
return $year; } add_shortcode
(
'year', 'year_shortcode');

Bonus! The shortcode [year] that we just created can also be used in the body text on all WordPress pages and posts. But if you use Divi, there is a better way: Dynamic content. Read more in the end of this post.

Add current month, day and more date formats.

Just add one or more of the following snippets to functions.php and replace “year” in the footer.php code snippet (step 2).

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] 2020
//Display current month
function monthyear_shortcode () {
$monthyear = date_i18n (‘F Y’);
return $monthyear;
}
add_shortcode (‘monthyear’, ‘monthyear_shortcode’);
[month] August
//Display current date as YYYY-MM-DD
function yyyymmdd_shortcode () {
$yyyymmdd = date_i18n (‘y-m-d’); return $ yyyymmdd;
}
add_shortcode (‘yyyymmdd’, ‘yyyymmdd_shortcode’);
[yyyymmdd] 2020-08-11
//Display current month and year
function monthyear_shortcode () {

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

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

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

Step 2. Copy footer.php to your child theme folder

Now we’ve created the shortcode [year] that will display 2020 if you put it in the body copy of a WordPress page or post. But in order for it to display in the Divi Bottom Bar (and that’s our aim, right?), we need to do a tweak in footer.php (where the bottom bar code is located).

  1. Use a ftp client (eg FileZilla) or your web hosting file manager to copy the file footer.php from /wp-content/theme/Divi/ to /wp-content/themes/your-child-theme/ (“your-child-theme” should of course be replaced by the name of your child theme).
  2. Open your brand new child theme footer.php in a editor and search for this code snippet:
<div class="container clearfix"> 
<?php
if ( false !== et_get_option( 'show_footer_social_icons', true ) ) {
get_template_part( 'includes/social_icons', 'footer' );
}

echo et_get_footer_credits();
</div> <!-- .container -->

3. Replace the code above with the code below;

<div class="container clearfix"> 
<?php
if ( false !== et_get_option( 'show_footer_social_icons', true ) ) {
get_template_part( 'includes/social_icons', 'footer' );
}
?>
<p id="footer-info">Copyright &copy; <?php echo do_shortcode('[year]');?> DiviMundo. All rights reserved.</p>
</div> <!-- .container -->

Change “DiviMundo. All rights reserved.” to the company name and content you want to display. This is now where you edit all the the bottom bar text (but the social media icons are not affected).  Save and have a look. It should look something like this:

Divi Bottom Bar with automatic current year

Explanation to the code snippet:

  • Copyright is plain text, displayed as: Copyright
  • &copy;  is code language for the special copyright character: ©
  • [year] is the shortcode that displays the current year automatically.

If you want to modify the background color, font color or font size in the bottom bar it business as usual: Open your WordPress dashboard and go to Divi > Theme Customizer > Footer > Bottom Bar. That was all for today. Enjoy!

But hey, where is the Dynanic Content feature?

Update: Since Divi 4 you can use Dynamic Content in your footers via the Theme Builder. Read more here

Elegant Themes recently announced the awesome feature Dynamic Content for Divi. The good thing is that you don’t have to use shortcodes and code PHP to display eg. Featured Image, Post Title, Author – or current date or year.

The bad news is that Dynamic Content only works together with the Divi Visual Builder, which is not available in the WordPress footer or Divi bottom bar – yet! Elegant Themes has announced that they will launch an update that enables the Visual Builder on all parts of your WordPress website, including the footer. But while we wait for that update, the [year] shortcode is your best friend.

Divi Dynamic Content

Dynamic Content makes it easy to fetch and embed automated content from other sources within your website.

Read more about Dynamic Content for Divi

Related posts

11 Comments
  1. The code snippet you say to search for is the same as the code snippet to add — I think the search for this code snippet is incorrect?

    Reply
    • Hi Carol! You are right about that. I’ve corrected the code now. Please let me know if it works for you.

      Reply
  2. Works perfect for me!

    Reply
  3. Thank you for this! Everything works perfectly, except I’ve added a hyperlink to the php that links to the website designer. The problem is, I don’t know how to add a space between “designed by” and the company name. Can you help?

    Reply
    • Please post the code you’ve used and I’ll have a look.

      Reply
    • WordPress chops your code so I can only see fragments. But you could try to add   to create a space.

      Reply
  4. Thank you, Victor!

    Reply
  5. Divi allow now to display date with dynamic content 🎉

    Reply
    • Yes, It’s a really nice feature. I’ll do a new tutorial on How to apply it soon.

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.