Options Framework 1.0

Although this is the “milestone” 1.0 release for the Options Framework there aren’t any major changes for end users in this version. It’s more of a developer release, providing additional filters and hooks.

If your theme currently works, it should be fine after this release too. But I would love for any developers who use it to test it out and make sure.

Below is a little rundown of the new features. All these updates were instigated via pull requests on GitHub. The full discussions can be found on Issue #78 by @inxilpro, and Issue #75 by @mattwiebe. Many thanks to all the contributors and testers.

Option ID Not Required

In the past theme authors were required to have the “optionsframework_option_name” function in their theme to declare the option ID. In this new version it’s not required. If the option ID is not set, it will the simply use theme name with the the “optionsframework” as a prefix.

I’d recommend leaving it in if it’s already part of your theme, but on future projects it’s your choice.

Location of Options.php Filterable

Not everyone likes to store all their files in the base theme directory. With this filter you can rename options.php to whatever you like, or move it to whichever directory you like. Here’s an example:

add_filter('options_framework_location','options_framework_location_override');

function options_framework_location_override() {
	return array('/extensions/options-renamed.php');
}

Options Array Filterable

The entire options array is also now filterable. This might be useful if you want to make a minor alteration to the options of a parent theme from a child theme, or if you just want to avoid using optionsframework_options in your theme.

Here’s an example that appends an additional option using the filter:

add_filter('of_options', function($options) {
	$options[] = array(
	'name' => 'New Option Added Via Filter',
	'id' => 'example_filtered_option',
	'std' => 'Default',
	'type' => 'text'
	);
  return $options;
});

A Fix for User Roles

The option panel has always displayed for users who had the edit_theme_options capability, but because of a quirk in the Settings API users actually need the manage_options capability in order to save them. Now the options should save for anyone with the edit_theme_options capability.

Info Option

You can now put html into the info option by default- which should make it easier to drop in images or other customizations.

About Devin

I'm a WordPress developer based in Austin, Texas. I run a little theme shop called DevPress and work for a startup called Nano. Find me on twitter @devinsays.

9 Responses

  1. Pavel

    Hi. Thank you for work!
    What to do to update the to version “Options Framework 1.0”
    a theme “Options Framework Theme”?

    Regards.

  2. Hi, Devin! I’m using the theme version. You had OPTIONS_FRAMEWORK_DIRECTORY and OPTIONS_FRAMEWORK_URL switched in 0.9, right? I updated to 1.0 and it took me a bit to figure out that you fixed it and are now using OPTIONS_FRAMEWORK_URL. :)

  3. I would like to suggest you, for a futur release, to add a “Save Options” button to the top.

    Indeed, when the user edits a top option and if the page is a bit high, he has to scroll to the bottom to find the save button.

    furthermore, if there are two “save” button, there is more chance to see it and think about saving data.

    Do you think it could be a good idea ?

  4. Dear Devin,

    How can I use the category option to pull in a category name for a featured post?

    Any and all help would be greatly appreciated.
    I’ve tried to post code here but for some unknown reason it doesn’t work for me.

    Thanks
    Tim

Leave a Reply