Learn Putting a Dynamic Copyright Date in the Footer of WordPress
Frequently, you will come across a website with an out-of-current copyright date, which is rather aggravating. There are however websites that merely display the current year as their copyright date, which is even more inconvenient because you have no idea how old the website is. Most developers are familiar with a simple PHP solution for this, but there is a more elegant alternative that we will show you. We’ll show you how to use a function to automatically produce a copyright date based on the published dates of your oldest and newest posts in this article.
Using PHP to Create a Dynamic Copyright Date
You’ll need to add some code to your WordPress theme files for this method to work. Check out our instruction on how to copy and paste code in WordPress if you haven’t done it before.
The most frequent technique to display a dynamic copyright date is to change the footer.php file in your WordPress theme. Simply copy and paste the code below into the line where you want the copyright notice to appear.
The issue with this code is that it cannot dynamically retrieve your site’s start date, therefore you must have a site that is at least a year old to utilize it.
For a dynamic copyright date, an elegant WordPress solution is available.
We came across a more elegant option proposed by @frumph of CompicPress Theme while exploring the web.
To do so, first add the following code to your theme’s functions.php file or a site-specific plugin’s functions.php file.
After that, add the following code to the footer.php file of your theme where you want the date to appear:
The following text will be added by this function:
© 2009 – 2021
Make sure your copyright dates are up to current. Utilize this strategy in your present and future WordPress sites.