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.

ws-plugin-1

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/’.

ws-plugin-2

Now the ‘style.css’ document is included by using the ‘wp_enqueue_scripts’ command.

ws-plugin-3

Next, yiu will see configuration options for the Admin sidebar. You can find help on the WordPress Codex area for this function here.

ws-plugin-4

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.

ws-plugin-5

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.

ws-plugin-6

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.

ws-plugin-7

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.

ws-plugin-8

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.

ws-plugin-9

Below are some screenshots of how the plugin will appear within the WordPress Admin dashboard:

dashboard-plugins

plugin-admin-page

You will be able to display information within your theme similar to:frontpage-plugin

Download from BitBucket here.

 

Support

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.

License

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.

You must give attribution to the original author (Ryan Fitton). You can give attribution by including my name and linking to my website: https://ryanfitton.co.uk within the plugin description.

Creative Commons Licence
WordPress Site Settings Plugin by Ryan Fitton is licensed under a Creative Commons Attribution 4.0 International License.

There are no comments, be the first. Use the form below to add your comment

Post a Comment