Typically you will notice a web site that has an outdated copyright date which is fairly annoying. There are additionally websites that solely present the present yr for his or her copyright date which is much more annoying since you gained’t know the way previous the positioning is. There’s a easy PHP resolution to this that almost all builders would know, however there’s a extra elegant method that we’ll present you. On this article, we’ll share a perform that may mechanically generate a copyright date primarily based on the printed date of your oldest and latest submit.
Easy PHP Resolution for Dynamic Copyright Date
You’ll paste one thing like this in your theme’s capabilities.php file
The issue with this concern is that you would need to add this as soon as your website is a minimum of one yr previous.
Elegant WordPress Resolution for Dynamic Copyright Date
Whereas browsing the online, we noticed a extra elegant resolution prompt by @frumph of CompicPress Theme. They’re utilizing this perform on their glorious ComicPress theme. This perform will generate a dynamic copyright date primarily based on the printed date of your oldest submit and your latest submit. If it’s the first yr of your website, then this perform will solely show the present yr.
You May Also Like : How to Create a WordPress Plugins
To implement this dynamic copyright date in your WordPress footer, open your theme’s capabilities.php file and add the next code:
Then open your theme’s footer.php file and add the next code the place you wish to show the date:
This perform will add the next textual content:
© 2009 – 2016
Don’t hold your copyright dates outdated. Reap the benefits of this system in your present and future WordPress websites.
If you liked this article, make sure to hit the bell for getting our latest updates and share this article with your friends in every social media platforms.