In this quick tutorial, we’ll go over how to make a simple child theme to override a WordPress theme’s footer.php file. Our themes follow WordPress.com guidelines on footer credits, which state:
Footer credits must be located in footer.php and match the format found in Underscores
Therefore, this tutorial will assume your theme follows the same guidelines. Themes can handle footer credits in many different ways, and we can’t cover every single one. If you have a different format, we suggest contacting the theme author for guidance.
Note: Before we get started, if your theme contains “encrypted” code, or your theme author threatens legal action against their own customers for removing their precious credit links…use another theme. There are plenty of amazing themes out there that are not user-hostile.
The Initial Child Theme
To start, we’ll make a simple child theme that enqueues the parent theme stylesheet and contains the required style.css header data that tells WordPress what the child theme is a child of.
We’ll be using our Owari theme as a parent, because it happens to have one of the simplest footers in our collection.
Since we also don’t plan on adding any custom styles in the child theme, we’ll dequeue the ceremonial child theme stylesheet and add a priority level of 11 to make sure it takes precedence over the parent theme’s enqueue function.
At this point, when we activate the child theme, it’ll be indistinguishable from the parent theme.
Now we’ll move on to overriding the footer credit text.
Override the footer.php file
To overwrite template files in child themes, all you have to do is place a file of the same name in the same place in the child theme directory. The child theme will then load that file instead of the parent theme equivalent.
child-theme/footer.php would override
parent-theme/footer.php, which is exactly what we’ll do here.
Let’s take a look the contents of Owari’s footer.php file.
Simply edit the footer credit code you find on lines 18-20 to whatever you want, and be very careful not to mess with any of the other markup, as you could break stuff.
Adding a Copyright Notice
We’re not just going to remove the credits, but replace them with a basic copyright notice. Most WordPress theme designs account for a footer credit area, so completely removing it would probably look a bit odd.
We’ll use the following code to output a copyright notice that includes the current year and the WordPress site name:
Copyright © <?php echo date( 'Y' ); ?> <?php bloginfo( 'name' ); ?>.
After using the above code to replace the credits in Owari’s original footer file, we’ll get the following:
The finished product can be found in the Owari Custom Footer Text repository.
Again, I won’t help replace footer links on themes that don’t follow a similar standard that Underscores uses. Some theme authors are delusionally clingy to their footer credit links, and use various methods of obfuscation to prevent you from easily doing it yourself.
If that’s the case, I would advise either using another theme or hiring somebody to do edit the footer text for you.