Plugin idea: Global text variables

So I develop a lot of wordpress sites for clients and I strive to enable clients to change all the info on their website themselves, while maintaining control over themes, plugins and all other technical stuff. This works fine using different user types and things like Admin Menu Editor.

But then a lot of times you have info that is not easily editable unless you have admin rights. A lot of times you set certain items like phone numbers in a top bar or copyright info in the bottom footer in theme options. These are things that are not easily changeable by the user, because they dont have the knowledge where to change things and I also dont want to give clients access to theme options because that’s just asking for trouble. So if their email or phone number changes, there is a bunch of places where it has to be changed – like changing the email in Contact Form 7, on the contact page, in the contact widget, etc.

So here is an idea for a plugin: Its like a settings page, where I as admin can add certain fields which are single line text boxes and a name. It works like a global variable, which the client can edit. So there might be a field for phone number, email address, but maybe also something like “copyright text” or whatever else gets used in certain places. Now the plugin generates a shortcode like [phone-number] or [email]. Now anywhere in the WordPress backend I can use this shortcode. So in theme options I can put in the footer text [copyright] and it will input whatever is in the copyright text field. In contact form 7 I can put [contact-email] etc. I think you get the point. If the client updates one of the fields, it changes anywhere the shortcode is used.

Does anyone know if something like this exists. I am fairly certain its possible using the settings API and some hooks and filters. I have some basic skills in PHP and are very familiar with WordPress, but have not developed a plugin yet. Anyone up for giving this a go?

Regards, Armin.

Read more here: Plugin idea: Global text variables

Leave a Reply

Your email address will not be published. Required fields are marked *