Even though this post is almost a year old, I hope this reply helps someone finding it on Google. I recently released a plugin for the WordPress Customizer that allows you to export or import your settings. Full details here… https://wordpress.org/plugins/customizer-export-import/
Justin
Hi Justin,
Thanks for the reply. I tested your plugin and it works pretty good however i cant seem to get my color fields to export. My color fields are being saved with the “option” type and i implemented the filter code you have listed on your plugin page but it doesn’t seem to be working.
Here is my filter code:
add_filter( 'cei_export_option_keys', 'pm_ln_export_option_keys' );
function pm_ln_export_option_keys( $keys ) {
$keys[] = 'mainNavColor';
$keys[] = 'mainNavBorderColor';
return $keys;
}
and here is a sample code i am using to create my color fields:
$headerOptionColors[] = array(
'slug'=>'loginButtonColor',
'default' => '#6cb9f3',
'label' => __('Login / Search / Account Button Color', 'quantumtheme')
);
$headerOptionColors[] = array(
'slug'=>'loginButtonBorderColor',
'default' => '#0a8bec',
'label' => __('Login / Search / Account Border Color', 'quantumtheme')
);
foreach( $headerOptionColors as $color ) {
// SETTINGS
$wp_customize->add_setting(
$color['slug'], array(
'default' => $color['default'],
'type' => 'option',
'capability' => 'edit_theme_options'
)
);
// CONTROLS
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
$color['slug'],
array(
'label' => $color['label'],
'section' => 'header_options',
'priority' => $priorityHeaderColors,
'settings' => $color['slug']
)
)
);
Any help on getting this to work would be appreciated.
Thanks.