The Options Framework Theme has all the code included to build a out a full featured options panel. It’s basically a bundled version of the Options Framework Plugin for those folks who want to build the options directly into the theme (rather than relying on a plugin).

Available Options
- text
- textarea
- checkbox
- select
- radio
- upload (an image uploader)
- images (use images instead of radio buttons)
- background (a set of options to define a background)
- multicheck
- color (a jquery color picker)
- typography (a set of options to define typography)
There’s also “heading” to define the menu tabs, and “info” if you just want to add some additional information to the panel.
Instructions
This theme has examples of all the options you can use (defined in options.php), and how to access them from the database (in index.php).
I’d suggest just digging in and getting familiar with the code.
I also have a video demonstration over on the plugin page, which also might be helpful.
When to Use Theme Version vs. Plugin Version
The code is 99% the same between the plugin and theme version. If you can do what you need with the plugin version, I think that’s the best route. If you find that you need to make significant modifications that aren’t possible with the plugin, go ahead and use the theme version.
Importing/Exporting Options
This is something I’m not supporting at this point, however someone has forked the code and built their own importer/exporter if you’re interested: https://github.com/vauvarin/options-framework-theme
Change the Menu Location
It’s highly recommended that you leave theme options under the “Appearance” menu where users expect them.
But, if you do decide to change the menu location it will break the media uploader. This is because the media uploader scripts are enqueued on $of_page= ‘appearance_page_options-framework’ in options-medialibrary-uploader.php. If you change the name or location of the menu, you’ll need to update the hook to be accurate, e.g. $of_page= ‘toplevel_page_options-framework’ and those scripts will load properly again.
Sanitization Filters
If you’re interested in how the options data is verified, or if you’re wondering why your script and embed tags are stripped out in the Options Framework, read this post.
Can I Use This Code in Commercial Themes
Yes! This code is 100% GPL. Please read the included license for more details.
Donations and Support
If you find this code useful, if it saves you time, or if it makes you money- please consider making a donation.
Just found this and wanted to say, this is just sexy. I’m loving the ease this brings to creating theme options. It literally makes my day; possibly my entire week. Grazie milla!
It doesn’t appear that the upload field works in 3.3.1. When I click “Save”, the image disappears. Please advise.
In the HTML of the uploader, I noticed the name was wonky. It was showing as “slideshow_image1″ instead of “optionsframework[slideshow_image1]“.
In optionsframework_medialibrary_uploader, I replaced the $option_name = $optionsframework_settings['id']; line with the same check you do in optionsframework_fields():
if (isset($optionsframework_settings['id'])) {
$option_name = $optionsframework_settings['id'];
}
else {
$option_name = ‘optionsframework’;
};
It is a hack, but it works. I don’t know why this didn’t effect me before.
Having problems with media uploader, just getting a white screen in the thickbox.
Moved the options to a top level menu, made the changes as above in the medialibrary-uploader and options-framwork files. Reset browser, no plugins active.
The only other change I made was to rename “Theme Options”. Could this be the problem? Any help on where to debug would be much appreciated.
This is WP version 3.3.1. Still nothing but a blank white screen in the thickbox.
I finally found the problem. I have a custom posttype and was using the add_action (‘admin_head’, “my_icons”) function to add a 32×32 icon. Every time I add that in, the media uploader breaks everywhere.
Extremely strange, and I’ve opened it up for discussion on wordpress.org.
So solved, definitely not the framework :-)
If anyone else runs into this, make sure you aren’t adding 32×32 icons using that add_action method.
Out of curiosity, is there a way to get the attachment ID from a file uploaded, so I can use the thumbnail sizes? (or just pass a thumb size?)
See: https://github.com/devinsays/options-framework-plugin/issues/65
Hi,
Thanks for this plugin/theme! I was actually surprised there’s not something like this built-in into WordPress :)
I was curious though, why didn’t you merge the importer/exporter code? It’s pretty useful, and seems to be mostly well-coded?
Cheers,
Julien
I’m trying to keep the codebase as slim and maintainable as possible. If it is not something that I think 80% of users/developers will use- I’m a bit wary of adding it in. See the WordPress philosophy under “Clean, Lean and Mean”: http://wordpress.org/about/philosophy/.
A couple people have asked about an export function, but it hasn’t been highly requested. What is your use case, if I might ask?
Hi Devin,
I’m building a theme that’s very versatile and has a fairly high number of options (though I’m trying to abstract some of them from the end-user as much as I can).
I’m also deploying a dozen of installs as demo and staging sites for the theme (think demo1.example.com, demo2.example.com, etc.) and want to automate that as much as I can. I’m looking into the new WP CLI too, but exporting/importing theme settings seem more straightforward from the theme itself.
I think it makes sense for the end-user as well: you can import settings from a demo site and then just change what you need to change, etc.
More generally than this precise feature, I think it would be cool to have more extensibility capabilities built in the Framework (so that people can distribute packaged “plugins” to your framework, so to speak). I will be suggesting a few things like this on Github in the next couple of days, I hope you’ll like them! (for instance, I would like to be able to configure — not extend — some options in `options.custom.js`).
Thanks for your terrific work on this framework,
Julien
Great. Look forward to comments on GitHub. For multiple installs you might want to look into something like this: http://www.kathyisawesome.com/421/customizing-wordpress-install/
It think it would be helpful to do a complete re-write of the plugin into object oriented PHP so that it could easily be extended- but am not quite ready to devote the energy to this yet.
Amazing theme/framework. Thanks so much Devin!
Hi,
is possible to add a on/off button? With this button i should be able to show or hide individual options in options panel.
Yes. See the “show hidden” option in Options Check. It would be very similar.
WP (3.3) debugger throws “Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or init hooks…blah, blah” error. Any idea how to get rid of it? …or is there any more convenient method to enqueue required scripts?
Thanks a ton for all of your efforts Devin!!!
Hi Devin,
Is it possible to have a 2nd instance of the options framework to capture different theme options. I don’t want this to be additional tabs, but a separate “page” with different tabs.
Hi Devin,
Is it possible to pass any additional variables to the textarea option? In particular, I need to default the rows and columns larger. Is this possible?
If you’re using the theme version, you can edit it directly. You can also pass a parameter in the option for columns: “options” => array(‘cols’=>’100′), but it looks like the option for columns needs to be added too.
Thanks Devin, I see it. In admin-interface “rows” is hardcoded at the moment, but I think I know how to update this. Will you be adding this to a future version?
I think the fully featured media library is not a good choice for uploads. Something much simpler, that just allows the user to upload an image would be a better choice, in my opinion. I’m trying to implement something like that.
If anyone has some suggestions, let me know!
You can look at the very early commits on this project. It originally used an ajax uploader- but I switched to more closely match the WordPress interface.
Thanks for the response, Devin!
Actually, I think there’s a problem with the media uploader WP 3.3.1. The function optionsframework_mlu_js_popup () is not tweaking the media uploader thickbox, removing the gallery settings and changing other stuff.
Check it out!
Would you be able to give me a more detailed bug report on it: https://github.com/devinsays/options-framework-theme/issues/23
Just wanted to say this is ridiculously helpful. Thanks so much to everyone involved in putting it together, helped me out no end!