/** * Get upfw Theme Options * * Array that holds all of the defined values * for upfw Theme options. If the user * has not specified a value for a given Theme * option, then the option's default value is * used instead. * * @uses upfw_get_option_defaults() defined in \functions\options.php * * @uses get_option() * @uses wp_parse_args() * * @return array $upfw_options current values for all Theme options */ function upfw_get_options() { // Get the option defaults $option_defaults = upfw_get_option_defaults(); // Globalize the variable that holds the Theme options global $up_options; // Parse the stored options with the defaults $up_options = wp_parse_args(get_option("theme_" . get_current_theme_id() . "_options", array()), $option_defaults); // Return the parsed array return $up_options; }
/** * Callback for get_settings_field() */ function upfw_setting_callback($option) { $upfw_options = upfw_get_options(); //print_r($upfw_options); $option_parameters = upfw_get_option_parameters(); $optionname = $option['name']; $optiontitle = $option['title']; $optiondescription = $option['description']; $fieldtype = $option['type']; $fieldname = "theme_" . get_current_theme_id() . "_options[{$optionname}]"; $attr = $option_parameters[$option['name']]; $value = $upfw_options[$optionname]; //Determine the type of input field switch ($fieldtype) { //Render Text Input case 'text': upfw_text_field($value, $attr); break; //Render Custom User Text Inputs //Render Custom User Text Inputs case 'text_list': upfw_text_list($value, $attr); break; //Render textarea options //Render textarea options case 'textarea': upfw_textarea($value, $attr); break; //Render select dropdowns //Render select dropdowns case 'select': upfw_select($value, $attr); break; //Render multple selects //Render multple selects case 'multiple': upfw_multiple($value, $attr); break; //Render checkboxes //Render checkboxes case 'checkbox': upfw_checkbox($value, $attr); break; //Render color picker //Render color picker case 'color': upfw_color($value, $attr); break; //Render upload image //Render upload image case 'image': upfw_image($value, $attr); break; //Render category dropdown //Render category dropdown case 'category': upfw_category($value, $attr); break; //Render categories multiple select //Render categories multiple select case 'categories': upfw_categories($value, $attr); break; //Render page dropdown //Render page dropdown case 'page': upfw_page($value, $attr); break; //Render pages muliple select //Render pages muliple select case 'pages': upfw_pages($value, $attr); break; //Render Form Button //Render Form Button case 'submit': upfw_submit($value, $attr); break; //Render taxonomy multiple select //Render taxonomy multiple select case 'taxonomy': upfw_taxonomy($value, $attr); break; //Render Typography Selector //Render Typography Selector case 'typography': upfw_typography($value, $attr); break; //Render Style Selector //Render Style Selector case 'styles': upfw_style($value, $attr); break; //Render Form Button //Render Form Button case 'button': upfw_button($value, $attr); break; //Render Text Input //Render Text Input case 'divider': upfw_divider($value, $attr); break; //Render Layouts //Render Layouts case 'layouts': upfw_layouts($value, $attr); break; default: break; } }