I recently built a WordPress site using the Yuma theme by Shark Themes. I wanted to find a way to remove the static credential in the footer: "Yuma by Shark Themes":
My first instinct was to use CSS to hide it (more on how to do that below); but I wanted to find a more elegant way to do it that also removed the attribution from the source code. Here's how I did it:
How to remove a function from a WordPress parent theme using functions.php
1) Use a child theme. If you make this change to the parent theme, it will probably be overwritten the next time you update the theme.
2) Add the following empty function to the functions.php file in your child theme (/wp-content/themes/yuma-child/functions.php
):
This empty function overrides the function of the same name in the parent theme: /wp-content/themes/yuma/inc/template-hooks/footer.php
:
Hat tip to https://obsessive-coffee-disorder.com/how-to-override-parent-theme-functions-in-wordpress/ for teaching me this.
An alternative and inferior solution using CSS
You could also just hide the footer element in CSS (/wp-content/themes/yuma-child/style.css
), but I think that's a less elegant solution and still leaves the attribution in the source code:
In case you're interested, the website I built was https://fivetimesfaster.org/ for Simon Sharpe, the author of Five Times Faster: Rethinking the Science, Economics, and Diplomacy of Climate Change (due to be published on 6 April 2023 by Cambridge University Press).
No comments:
Post a Comment