WordPress Site Settings Plugin
Download from BitBucket here.
This plugin has been created to make it easy to integrate a ‘Website Settings’ page into WordPress, this settings page can include different options such as a Telephone Number, Contact Email Address, META Keywords and Footer Information.
Let’s start, first download the code from this GIT Repo hosted on BitBucket. Place your downloaded contents into a new folder named ‘wp-settings-panel-plugin’. This folder should be within your WordPress plugin folder: ‘/wp-content/plugins/’ folder.
This plugin uses only two files, one for the plugin core and the other for minimal styling.
The ‘options.php’ file is the core code of the plugin.
Firstly, the plugin META information is shown, along with some comments of how to display the final values.
You will see code to add additional settings and links. You can use these additional links for a Support page, this isn’t really necessary but may help a user if they are having issues.
Remember you will need to replace the support URL with your own on line 52: ‘https://ryanfitton.co.uk/blog/wordpress-site-settings-plugin/’.
Now the ‘style.css’ document is included by using the ‘wp_enqueue_scripts’ command.
Next, yiu will see configuration options for the Admin sidebar. You can find help on the WordPress Codex area for this function here.
Now, let’s setup the settings page content. You can think of this section as a wrapper for the input fields. This code uses callbacks to retrieve the content for this page, these functions are part of the WordPress Settings API, introduced in version 2.7.
Next, we configure and register the setting input field names. We also set the text which is shown on the page with the ‘display_header_options_content’ function.
Now, setup functions to render the input fields are used. These input fields are linked by their name tag, this name tag will match the same name defined within the ‘add_settings_field()’ function.
Lastly an ‘add_action()’ function is triggered before any other hook when a user access the admin area, this will run the ‘display_options()’ which will add and register the setting fields.
Before we finish, the ‘style.css’ document requires some styling rules. These CSS rules are only used to style the input and text area widths and heights.
Below are some screenshots of how the plugin will appear within the WordPress Admin dashboard:
Download from BitBucket here.
I am unable to provide any support and security updates. However I do use this plugin for some of my own projects, therefore I may add new features in the future. These updates will be very infrequent. If you’re a WordPress developer you should be able to update and maintain this plugin yourself.
The license for this plugin is Creative Commons: Attribution 4.0 International.
This means you can Share and Redistribute in any medium or form. You can Adapt the code to suit your needs, and build in new code. The plugin can be used personally or commercially.
WordPress Site Settings Plugin by Ryan Fitton is licensed under a Creative Commons Attribution 4.0 International License.