Happy new year!
With the fresh new year upon us, have you found yourself having to remember to update the copyright at the bottom of your WordPress website? If so, this blog post is for you!!
NOTE: This is an advanced WordPress instruction. To add a copyright year to your footer (in PHP) that will stay updated with the current year, you will need to feel comfortable working within the files that make up your active theme.
The file we will be accessing & working with today is called “footer.php”. To access your theme files, you can either FTP to your current theme ( your-site-root/wp-content/themes/your-theme/ ) or within the WordPress interface, you can find your current theme files under “Appearance”, “Editor”.
Let’s change the footer information on this site to say “© XXXX WordPress 101 Class”, where XXXX = the current year.
The site footer, at the very least, tends to say something to this effect:
<?php bloginfo('name'); ?>
That code yields the site title you set within your “Settings”, “General”. For this site, it’s “WordPress 101 Class”. We’re going to use that site title, but add a copyright symbol, and the current year to the front of it.
To add the copyright symbol, type:
To add the year, in PHP which will echo the current year, type:
<?php echo date("Y"); ?>
So all together, the new line in the footer.php that you have modified will look like this:
© <?php echo date("Y"); ?> <?php bloginfo('name'); ?>
Don’t forget to add spaces between your individual code snippets, for readability! Feel free to add any additional static text you may wish to have in your footer & enjoy the freedom of not having to remember to update your website copyright with every new year! That’s something to celebrate!