Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Re: Issue #72: fixes settings not saving due to settingsbytab in regi…

…ster_setting() callback; remove some cruft
  • Loading branch information...
commit afd0c1ddb268bb969954c2fa12734c45eae56144 1 parent 791d6a9
@chipbennett authored
View
2  functions/options-customizer.php
@@ -34,8 +34,6 @@ function oenology_register_theme_customizer( $wp_customize ){
// Get the array of option parameters
$option_parameters = oenology_get_option_parameters();
- // Get the array of option defaults
- $option_defaults = oenology_get_option_defaults();
// Get list of tabs
$tabs = oenology_get_settings_page_tabs();
View
6 functions/options-register.php
@@ -33,8 +33,9 @@
'oenology_options_validate'
);
+
/**
- * Theme register_settin() sanitize callback
+ * Theme register_setting() sanitize callback
*
* Validate and whitelist user-input data before updating Theme
* Options in the database. Only whitelisted options are passed
@@ -76,8 +77,9 @@ function oenology_options_validate( $input ) {
$submittab = $tab['name'];
}
}
+ global $wp_customize;
// Get settings by tab
- $tabsettings = $settingsbytab[$submittab];
+ $tabsettings = ( isset ( $wp_customize ) ? $settingsbytab['all'] : $settingsbytab[$submittab] );
// Loop through each tab setting
foreach ( $tabsettings as $setting ) {
// If no option is selected, set the default
View
46 functions/options.php
@@ -518,36 +518,6 @@ function oenology_get_option_parameters() {
'since' => '2.5',
'default' => 'always'
),
- 'default_options_tab' => array(
- 'name' => 'default_options_tab',
- 'title' => 'Default Options Page Tab',
- 'type' => 'internal',
- 'description' => '',
- 'section' => false,
- 'tab' => false,
- 'since' => '2.3',
- 'default' => 'varietals'
- ),
- 'default_reference_tab' => array(
- 'name' => 'default_reference_tab',
- 'title' => 'Default Reference Page Tab',
- 'type' => 'internal',
- 'description' => '',
- 'section' => false,
- 'tab' => false,
- 'since' => '2.3',
- 'default' => 'general'
- ),
- 'theme_version' => array(
- 'name' => 'theme_version',
- 'title' => 'Theme Version',
- 'type' => 'internal',
- 'description' => '',
- 'section' => false,
- 'tab' => false,
- 'since' => '1.2',
- 'default' => '2.3'
- )
);
return $options;
}
@@ -610,15 +580,13 @@ function oenology_get_settings_by_tab() {
// Loop through the option parameters
// array
foreach ( $option_parameters as $option_parameter ) {
- // Ignore "internal" type options
- if ( 'internal' != $option_parameter['type'] ) {
- $optiontab = $option_parameter['tab'];
- $optionname = $option_parameter['name'];
- // Add an indexed array key to the
- // settings-by-tab array for each
- // setting associated with each tab
- $settingsbytab[$optiontab][] = $optionname;
- }
+ $optiontab = $option_parameter['tab'];
+ $optionname = $option_parameter['name'];
+ // Add an indexed array key to the
+ // settings-by-tab array for each
+ // setting associated with each tab
+ $settingsbytab[$optiontab][] = $optionname;
+ $settingsbytab['all'][] = $optionname;
}
// Return the settings-by-tab
// array
Please sign in to comment.
Something went wrong with that request. Please try again.