Started as a blog platform, today WordPress is turned into a powerful CMS with great options for everyone to create and maintain his own business or personal site. Every year and with every new version, 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 functionality, 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 a unique look for 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 on the real theme creation and at the same time, add some interesting and helpful options with not so much coding.
First of all, let’s take a look at 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 at 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 at 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
NHP Theme Options by Lee Mason is another choice 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_Options global and then to use it’s
show methods. NHP Theme Options includes built-in validation, great default settings and good documentation posted on GitHub that can help you a lot.
Dev options explanation:
CheezCap – Cheezburger Custom Administration Panel is another library for creating simple theme options. While it doesn’t offer such a big variety of the options field, it is easier and faster to use. It is not updated recently so you will have to check if is compatible 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
Up Themes Framework is another popular solution and it will be a very good choice as it can provide image management with re-size options, import/export of the created settings, Layout and SEO management, Color Scheme picker and more. There are also a lot of working examples to help you understand the way it works. It is free and available at 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 your 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 for WordPress:
- 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, or maybe you have plans to create a lot of different themes – then your choice is going to 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 choice it is time to implement the desired options. This can be done in a similar manner and, of course, depends on what you require it to do.
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 editing 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 themes with features that webmasters are looking for. You will need to spend some time learning how they work, but this is good investment of your time because it will help your clients and users choose your theme and be happy using it. A good framework will also 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 your desires and needs and you will be really surprised how easy it can be to create awesome new options for your themes.