Display Dynamic Year in copyright text in footer in WordPress

Hello guys, so you have to update year in WP footer copyright text every year manually?  What if you forget to update, to your visitors it means your site is no longer active or managed in current year. Also if you are developing the site for your client with zero technical knowledge then you would never want them to update the year manually. So what? Better if it gets updated dynamically on its own. Today we will see various ways to display date/year in WP Footer dynamically.

copyright

1) Using Plugins:

There are various plugins that can be used to display dynamic year anywhere on your WP site. Here are two free plugins available in WP plugin repository that I have tested and recommend. You can download and use any of them

https://wordpress.org/plugins/jonradio-current-year-and-copyright-shortcodes/
https://wordpress.org/plugins/dynamic-dates/

Both plugin offers shortcake so if your theme provides Footer text area which executes short codes then just use the short code in Footer text area and it would do the job. Alternatively you will have to edit the theme’s Footer.php and use the shortcode in do_shortcode() function https://developer.wordpress.org/reference/functions/do_shortcode/. Feel free to comment if you need help with that.

2) PHP function:

Another simple and quick method, you can add the following code in Footer.php file.

If you want to display start date then just enter the start year manually with above code as it will never change 😀 so you can enter the code given below:

3) Using functions.php (Recommended):

This is great way to display start and end year dynamically. You need to add the code given below in custom-functions.php or functions.php file of your theme:

 

Then open footer.php file located in root directory of your theme and use the function dynamic_copyright() to display dynamic copyright text. So you need to use the code given below:

Above code would pick up the start date from first post in your site and current year from last post. 

 credits: wpbeginner 

So its easy and quick to add a dynamic year in Footer copyright text (actually anywhere in your site using above methods) so always maintain your site credibility and keep the copyright year updated.

 

 

About sanjeev

sanjeev
Dreamer, Blogger and Thinker. I love to help people in solving their problems. You can also join me HERE

Related posts: