Options Framework Plugin

The Options Framework Plugin makes it easy to include a full featured options panel in any WordPress theme.

I built this plugin so theme developers can concentrate on making the actual theme rather than spending a ton of time on building an options panel from scratch. It’s free to use in both commercial and personal projects, just like WordPress itself.

There’s also a theme version if that better fits your project.

Video Demo

You can find the “Options Check” theme referenced in the video on GitHub.

When Not to Use This Plugin

If you just have a couple options and none of them are complicated color pickers or image uploaders, I’d recommend checking out “A Sample Theme Options Page” from Ian Stewart. Using the Options Framework in this case would be overkill.

Instructions

Download the plugin and activate it on your site.

To learn how to set up the options panel in your own themes, download the Options Check theme from GitHub and use its files as a base. It’s a blueprint for how the Options Framework works with a sample option panel with every type of option you are able to use and a demo of how to display each one on the front end.

You can also purchase the Options Kit, which is a collection of starter themes, including Options Check.

To get started:

1) Copy “options.php” from the Options Check theme into your own theme.
2) Edit the array in “options.php” to define the options you want to use.
3) Add the following function to your theme so it will use default settings even if the Options Framework plugin is not installed:

/* 
 * Helper function to return the theme option value. If no value has been saved, it returns $default.
 * Needed because options are saved as serialized strings.
 *
 * This code allows the theme to work without errors if the Options Framework plugin has been disabled.
 */

if ( !function_exists( 'of_get_option' ) ) {
function of_get_option($name, $default = false) {
	
	$optionsframework_settings = get_option('optionsframework');
	
	// Gets the unique option id
	$option_name = $optionsframework_settings['id'];
	
	if ( get_option($option_name) ) {
		$options = get_option($option_name);
	}
		
	if ( isset($options[$name]) ) {
		return $options[$name];
	} else {
		return $default;
	}
}
}

Available Options

These are the options currently available. If you feel there is something I left out, get in touch and perhaps I can add it.

  • 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)
  • editor

There’s also “heading” to define the menu tabs, and “info” if you just want to add some additional information to the panel.

Returning Option Settings

If you look in index.php of the Options Check theme, you’ll see how each option is returned. It should look something like this:

of_get_option($id,$default);

What if the Options Framework Plugin is not installed?

The neat thing about this plugin is that it isn’t required for your theme to work. Each option should have a default which will be used if the plugin isn’t installed. Take a look at Portfolio Press without the plugin activated to see how it works.

There are a couple ways to let the user know that options are available if the plugin is installed: a notice on theme activation, an auto prompt on activation, notes in the documentation, etc. I’ve left this up to the theme authors to decide how to implement.

Download the Plugin

Download from WordPress Repository
Download Development Version
Learn About the Options Kit

Additional Tutorials

Future Development

If you’re looking to do something with the plugin that isn’t currently possible, post it in the comments or on GitHub.

Exporting/Importing Options

If you are exporting SQL databases, this thread might be of interest to you. There’s also a fork of the theme version, where someone built this out: https://github.com/vauvarin/options-framework-theme

Credits

The Options Panel was originally based on the excellent work of Woo Themes and still uses some of their code.

A huge thanks to all the people who helped out on GitHub, including @mfields, @helgatheviking, @celtic7, @samargulies, @mattweibe, @Mamaduka and any others.

Also a big thanks to folks who made donations to pay for a third party code review: Jason Schuller, Mint Idea, Luke McDonald .

If you would like to donate to the ongoing plugin development you can purchase the Options Kit for $20 (which has helpful demo themes).

574 Responses

  1. Firstly, great plugin. Thank you.

    The only problem I keep running into is with ‘wpautop’ being set to true however the output does not include paragraph tags, only “&nbsp” instead.

    Any solution to this? Thanks

  2. Marcella

    Hi Devin!
    I have downloaded a wordpress theme from themeforest and options framework plugin was included. I have installed it, but when i try to activate it, it gives me this fatal error
    “Plugin could not be activated because it triggered a fatal error.

    Fatal error: Cannot redeclare optionsframework_init() (previously declared in C:\Users\user\Desktop\USBWebserver v8.6\root\wordpress\wp-content\themes\blueblog\inc\options-framework\options-framework.php:121) in C:\Users\user\Desktop\USBWebserver v8.6\root\wordpress\wp-content\plugins\options-framework\options-framework.php on line 57″
    I’m using WordPress 3.9.1.
    What can i do?
    Thanks.

  3. Anfisa

    Hello Devin,
    Thank you very much for plugin. Great job! I like it very much.

    One question. Is it possible to get “Default” button for every option like “Defaul color”? It would be is very useful if a customer plays with options and then wants to reset one or two options, instead of all options.

    Thank you in advance for your answer. :)

  4. Stas Newdel

    Hi there – thank you for the great plugin!

    I have a question about the conditional logic – making another option appear when the checkbox clicked. Do the IDs of both elements have to be related in some way? Is the implementation based on using a naming convention by adding “showhidden” to the parent option and “hidden” to the child?

    BTW, I am using it as a theme, not as a plug-in.

    Thanks!

  5. Leeza

    The tabs for both the ‘Theme Options’ and the ‘FT Options’ do nothing. In other words, the first tab for ‘Basic Settings’ shows content but nothing happens when you attempt to open the ‘Advanced Settings’. Essentially useless, since that’s where the most useful settings are located. This holds true after activating several themes. Any guidance would be most welcome. By the way, I followed the guidance found in the Theme Specific video.

      1. Leeza

        Thank you Devin, I did just that with no change. As I attempt to activate Options Framework, the error states “Cannot redeclare optionsframework_init() (previously declared in /wp-content/themes/booster/options-framework/options-framework.php:35) in /wp-content/plugins/options-framework/options-framework.php on line 57″

        (I removed the entire path from this message, given I wasn’t sure it would be relevant or unwise to post the directory path publicly)

        Could part of the issue be that there’s two options-framework.php files in two locations? Do I delete one of them, do you think? Thank you again for your help!

  6. Fedor

    Hi! i use Devion wordpress theme
    on homepage i need video carousal but theme options doesnt work
    i see this error:

    Your current theme does not support plug-in Options Framework.

    Please help

  7. Hi –

    I am using the theme ROMO which lists the Options Frame Work as neccessary. I have it installed and the plug in is active. The only issue is I am getting error messages at the top of WordPress since I have activated the plugin:
    Warning: include_once(/home/melges5/public_html/wordpress/wp-content/themes/romo/lib/admin/admin.php): failed to open stream: No such file or directory in /home/melges5/public_html/wordpress/wp-content/themes/romo/lib/init.php on line 170

  8. Mathieu S

    Hi, thank you for this great tool.
    I would like to use the framework not only for a theme options but also for an option page on a custom post type. Is it possible ?

  9. Yuvraj Khavad

    Thanks for great plugin ……..

    I have a one problem, when we transfer site form one server to another or local to live that time our all data of “theme option” gone so that time we need add again those data. anyone have idea how to solve this problem.

    Thanks
    Yuvraj

  10. Lawrence

    Hi, I am just trialling your theme on WordPress 4 and options framework 1.8.2 which is installed and activated. But I am getting the message, “Your current theme does not have support for the Options Framework plugin”. I have uninstalled and tried again, but no luck. Any ideas? Many thanks ;-)

  11. Ephram Curry

    Hi Devin!
    I have downloaded a WordPress theme named Xerxes from from the site http://www.fabthemes.com/. I also installed and activated the required Options Framework Plugin. Although both the Theme and plugin are activate, it gives me this error
    Your current theme does not have support for the Options Framework plugin.

Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>