Started as a blog platform, today WordPress is turned into a powerful CMS with great options for everyone to create and maintain his own bussiness or personal site. Every year and with every new vesrion we can find more and more useful features about WordPress. Also you are able to find a lot of free and premium themes to design your project and plugins to adjust its functinality, and why not to create your own theme or plugin.
To create a WordPress theme is not a high level astronaut job – you can learn how to do it in some simple steps. When you finish with the design and set your new theme you would like to give your users some options – this will help them to create unique look of their site and to avoid some features that they don’t really use to make their project faster and easier to use.
So today we will explore how to use popular theme options frameworks for our theme. This will help you to spend more time to the real theme creation and in the same time to add some interesting and helpful options with not so much coding.
First of all let’s take a look to some popular ways to create theme options:
- Theme Options Plugin – this is a free and a really good plugin that offers you a lot of good features like color pickers and image radio buttons, it can be downloaded by the official WordPress repository and from the site of his author Devin Price. Also the author presents a demo theme to help you learn how to use the plugin, some additional educational examples and documentation – could be found on his site. After you download the plugin and take a look to the demo theme you need to copy the options.php in your theme and change the “options” array in accordance to your needs. Next step is to add the function in your function.php file to relate the options framework to your theme and you are ready to go. This framework offers a lot of different field types:
- upload (an image uploader)
- images (use images instead of radio buttons)
- background (a set of options to define a background)
- color (a jquery color picker)
- typography (a set of options to define typography)
- NHP Theme Options by Lee Mason is another choise for the theme creators. Of course it is based on the Setting API but it comes with a lot of field types and makes your job easier. The main point is that you have to define
$NHP_Optionsglobal and then to use it’s
showmethods. NHP Theme Options includes build-in validation, great default settings and good documentation posted in GitHub that can help you a lot.
- ProPanel is paid (15$) but а good solution if you need customer support and a big selection of ready for you options, it has plug-and-play set up, a lot of training videos and a dashboard styling that is easy to your clients and can be changed with the default WordPress dashboard layouts. The principle is similar – you need to create the code for your options page and to add the options array you need. The parameters are explained in a good manner in the video tutorials, actualy you just need to look to the example and change them to what you need. Simple enough.
- CheezCap – Cheezburger Custom Administration Panel is another library for creating a simple theme options – doesn’t offer such a big variety of the options field but it is easier and faster to use. It is not updated recently so you will have to check if is complatible with your WordPress version. On the other hand it is free and well documented in GitHub. How it works – you need to add the CheezCap folder to your theme, to require cheezcap.php in your functions.php file and then to create your options in cheezcap/config.php. The actual options creation is related to editing an array in function cap_get_options() where you need to create “Group” objects that accepts the following parameters: Name, ID, Options array (here are your actual options). Each Group will appear in different options tab in your theme and you need to add a relevant code in your theme file to tell them what is happening when some option is chosen.
- Up Themes Framework is another popular solution and it will be a very good choise as it can provide image management with resize options, import/export of the created settings, Layout and SEO management, Color Scheme picker and more. Also there are a lot of working examples to help you understand the way it works. It is free and available in GitHub. The way of work is similar – you need to add the framework folder to your theme and to require it in theme functions.php file. To make yout own options you need to create a page in theme options folder where to set your custom array for the new options. The authors have provided a guide for developers if you want to include the framework in your own theme.
How to chose Theme Options Framework:
- The most of the presented frameworks are working in a similar way, there are differences of course but they are very well specified in the documentations. No matter which one you will choose you will have to learn more about code and Setting API to be able to work with them
- The first thing you need to do before start adding options to your theme is to make a simple list what kind ot options do you need. This will make your choose more obvious – if you need specific type of fields you will pick the framework that offers that field or may be you have plans to create a lot of different themes – then your choice gonna be related to the solution that offers you import/ export options or you just want to have some simple and easy options – then it is better to use lighter and faster framework
- Other good advice before you choose the best framework for your theme is to check if it is updated recently and is compatible with WordPress current version. Once you have made your choise it is time to implement the desired options. This can be done in a similar manner and of course depends by your choise. The main point is that you have the following steps: installing or adding the framework/plugin, include the options – in the most cases in function.php file of your theme. After that you just need to change the options to these you need by eddting the array of options and it’s parameters. The most of the frameworks have pretty good examples to help you understand the functions easier. This is a really brief summary because we are not looking to the specific framework but these are the main points you should follow.
Finally the Theme Options Frameworks are really useful tools that can help you develop interesting and popular WordPress theme. You will need to spend some time to learn how any of them is working but this is good investment because it will help to your clients and users to choose your theme and be happy using it. Also this will help you to work faster and create a lot more features with every theme. So take a look, try and choose the best solution that fits to your desires and needs and you will be really suprised how easy will be to create awesome new options for your themes.