Easily add a Control Panel to your WordPress Themes.
Usage
Upload the files at the bottom to your themes folder.
Create a functions.php file (if it doesn’t already exist).
Add the following code to the top of your functions.php
1 | require_once('control-panel.php'); |
Declare an array having a list of all the options you would like to be edited by the users
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | $Options = array ( array ( 'Type'=>'Title', 'Value'=>'Settings' ), array ( 'Type'=>'Text', 'ID'=>'FooterText', 'Label'=>'Footer Text', 'Description'=>'Add text to be added to the footer' ), array ( 'Type'=>'TextArea', 'ID'=>'FooterScripts', 'Label'=>'Footer Scripts', 'Description' => 'Add any piece of javascript to be added to the footer, just before the closing </html> tag.' ), array ( 'Type'=>'Selec.t', 'ID'=>'FooterColor', 'Label'=>'Footer Text Color', 'Values' => array ('3B5998' => 'Facebook Blue', '21759B' =>'WordPress Blue'), 'Description' => 'Choose the color for the text in the footer.' ), array ( 'Type'=>'CheckBox', 'ID'=>'ShowWPLink', 'Label'=>'Show WordPress Link', 'Description' => 'Check this box if you wish to show the wordpress credit in the footer.', 'Default'=> 'true' ), array ( Type=>'Close' ) ); |
The above options basically explain all of the possible types of input you can currently add using this script.
Now, to create a Control Panel object, and initialize all the hooks for the admin page, add the following code
1 2 3 | $Panel = new ControlPanel('My Theme'); $Panel->SetOptions($Options); $Panel->Initialize(); |
Accessing Settings within the Theme
To access any setting set by the user from the Theme Control Panel in your theme files (index.php, sidebar.php etc), use the following code
1 2 | global $Panel; echo $Panel->Settings('ID'); |
where ID is the ID of the property specified in the Options array.
Screenshots
Download
WordPress Theme Control Panel (0)As this is the first release, there would be bugs in it. Please report the bugs, and ideas via the Contact Me page, or by sending a tweet to @DrunkAdmin
A special thanks to the following posts for inspiration
- http://blog.themeforest.net/wordpress/create-an-options-page-for-your-wordpress-theme
- http://forthelose.org/how-to-create-a-theme-options-page-for-your-wordpress-theme
- http://www.catswhocode.com/blog/how-to-make-a-control-panel-for-your-wordpress-theme

Thank you very much. Haven’t tried out it yet but I’m very happy having found this page… I hope you keep on developing this tool!
Just used it in a theme and it’s great. No more having to hack together admin menus and forms. I love it.
One thing, it assumes the path of the control-panel directory which is a problem if you keep things in a “library” folder such as I do. So I added a path parameter.
Help!
Great tutorial to start with! However, I am lost on the adding of the Control Panel Object… your 3 lines at the end. Where do these get placed?
I am modifying this slightly to run off of admin.php rather than themes.php. My intention is to make this a universal setting part, so that no matter which theme I choose, these settings and variables will remain from theme to theme. To accomplish this, I will need to add the same globals to all the themes I use.
But adding this last step ($Panel) confuses me… where do I put it, and on the first line where it declares ‘My Theme’, what would I put there?
Thanks in advance!
Hi Ed,
You have to add those lines in the functions.php file.
My Theme is the name of your theme. It’ll be as the title of the theme options page in the WordPress Admin Panel -> Appearence
The last step having $Panel is for using the values of the settings inside a theme. Like, if you add a textbox for ‘meta description’ with ID = ‘meta’, you will need to add the following code to header.php to actually use the value of that setting.
< ?php global $Panel; echo $Panel->Settings(’meta’); ?>
Here’s a great website website for finding unclaimed property and assets.
Nathaniel
Hello, I contacted you earlier because of a broken link, and after your response the link still seems to be broken, a “page not found” is displayed instead of the download when you click the link.
Seems the download link is broken? Let me know when it’s back up and running, I’d love to test this out!