Color Options from Theme Customizer API not returning via get_theme_mod()
-
05-11-2019 - |
Question
I am working with the Theme Customizer API and am going crazy trying to find the stored values. The values successfully save and update on the front-end, so they are obviously registered successfully, however, I'm storing the options as theme specific via this method where $this_theme
is set as $this_theme = preg_split('/themes\//', get_stylesheet_directory_uri())[1];
. The following code is inside of a foreach
loop and iterating over a multi-dimensional array with all of the variable metadata for each option (referenced below as $param['foo']
).
I'm using this method for dropdown options for font selection and also for colors, but when doing get_theme_mod($this_theme . '_theme_options')
the returned results show the font dropdown options but not the WP_Customize_Color_Control
options. I'm going crazy trying to find a divergence between the two and have not found any. Thanks so much!
$wp_customize->add_setting( $this_theme . '_theme_options['. $setting .']', array(
'default' => $param['default'],
'sanitize_callback' => 'sanitize_hex_color',
'type' => 'option',
'capability' => 'edit_theme_options',
'priority' => $i
) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
$this_theme . '_theme_options_'. $setting,
array(
'label' => $param['label'],
'section' => $param['section'],
'settings' => $this_theme . '_theme_options['. $setting .']',
'priority' => $i
)
)
);
No correct solution