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).

661 Responses

  1. Hi Devin, is this can be used to create plugin options page? I’m trying to implement it as a plugin options page but can’t figuring it out.

    sorry for my bad english.
    regards

  2. I installed this plugin with Portfolio Press, but Theme Options does not appear in the Appearance menu. I’ve tried this numerous times by activating, deactivating, logging in and out and refreshing page. What is wrong. WordPress 4.5.2, PP 2.7.2. Many thanks for any assistance.

  3. I have installed Spacious theme, but Theme Options does not appear in the Appearance menu. How do I get Theme Options into the Appearance menu? I am currently using WordPress 4.5.2. There is also no Customizer only Customize in my Appearance menu.

  4. Thanks for this support page. I am getting the message “Your current theme does not have support for the Options Framework plugin” after switching from a Genesis premium theme to a Theme Forest theme called Lush. Does that merely mean that, as you say above, your plugin is “overkill” for my set-up, please? I have set up a child theme of course. Thanks very much.

  5. Very awesome awesomeness, man. Thank you. What I’m seeing is this:
    When the `options-check` directory is included (and active) as a theme and options-framework plugin is activated, then the Demo Options are available under Appearance -> Them Options.
    When portfolio-press is activated, if options-framework plugin is activated, there is a (harmless) message that the theme does not support options-framework, HOWEVER the (portfolio press) options are available under Appearance -> Customize. For my theme I copied the `extensions` directory from portfolio-press, then added the bottom six lines of (actual) code from it’s funcions.php file to mine, and my theme can hold all the same options. Now all to be done is refine to my needs and show them in the front end. (Header-color already does!). So – you rock! Hard!

  6. When this plugin is active, my Media Files will only appear in list format, I can’t set a featured image, and there are other image problems. I can deactivate, do what I need to, and then reactivate and my changes are there. Any patch or suggestion I’m missing?

Leave a Reply