This simple plugin allows you to edit the Divi theme’s footer text form the customizer. It’s still a bit rough around the edges, but works great.
Below are instructions, the code, and both simple and technical explanations of why this is necessary.
To use the plugin:
- copy the code below
- add it to a file called “edit-divi-footer.php” in your plugins directory
- log in to WordPress and activate the plugin
- go to the WordPress theme customizer
- select “Footer” and then “Footer elements” and you will see the Footer Text option
- change the option’s text, watch the live preview update, then save the customizations when you are happy
- you can NOT include PHP code in the output, but simple HTML tags should be allowed
- your site should now have an updated footer text!
Here’s a demo:
Why this is needed
Short, non-technical version
I like Elegant Theme’s Divi theme. As an experienced developer, I probably shouldn’t. But as a user, and as someone who builds budget WordPress websites for lots of small charities, it represents amazing value for money and has great flexibility without being too over-complicated.
But one annoying thing about Divi is that it has this text in the footer that says “Design by Elegant Themes. Powered by WordPress”. And, on the face of it, there is no simple way to change this.
This plugin overcomes this by letting you change this text easily and safely.
Longer technical version
In the past I’ve used a child theme to change the footer text in Divi. This means creating a very basic theme structure of my own, copy-and-pasting the contents of Divi’s footer.php file into the child theme, and editing it there. This has, historically, been one of the first things I did when setting up a site using Divi.
This is really bad practice, because if a Divi update modifies the footer.php code, I need to update all my child themes that I’ve created.
Now, I don’t know why it took me so long to realise, but yesterday I was doing something totally non-Divi related, and I came across some text in WordPress core that I wanted to change. It didn’t have a filter, but it did use WordPress’s translation functions, called ‘gettext’ functions. These functions say “Here’s a piece of text I want to use – can you translate it for me please?”. These functions have odd-looking, short names that have underscores at the start, like this:
Which will, presumably, output “Bonjour” if your computer is set to use French. If you’re just echoing some content then you can use the shorthand function:
Divi uses these translation functions when outputting this footer text.
And it turns out you can intercept calls to the translation function and use them to modify their output using a WordPress filter. That’s exactly what this plugin code does. It adds a theme customizer option, and then uses the filter I’ve described to modify the text.
It’s probably not massively efficient as the filter is added to every translation call, which will slow things down a bit. If you are using caching then this won’t be a problem, but it has a performance impact.
It’s pretty simple, but not without room for improvement.
Hopefully it’s useful to someone.