/** * Returns the options array for the theme. * * @package Customizr * @since Customizr 1.0 */ function tc_get_options($option_name) { global $tc_theme_options; $saved = (array) get_option('tc_theme_options'); $defaults = tc_get_default_options(); //located in admin/tc_customize.php //$defaults = apply_filters( 'tc_default_theme_options', $defaults ); $options = wp_parse_args($saved, $defaults); $options = array_intersect_key($options, $defaults); return $options[$option_name]; }
/** * Get the saved options in Customizer Screen, merge them with the default theme options array and return the updated global options array * @package Customizr * @since Customizr 1.0 * */ function tc_get_theme_options() { global $tc_theme_options; //Customizer options $saved = (array) get_option('tc_theme_options'); $defaults = tc_get_default_options(); $defaults = apply_filters('tc_default_theme_options', $defaults); $tc_theme_options = wp_parse_args($saved, $defaults); $tc_theme_options = array_intersect_key($tc_theme_options, $defaults); return $tc_theme_options; }