$color_menu_slug ){ // add the section of the elements color menu to theme customization $wp_customize->add_section( $color_menu_slug, array('title' => __('Color : ', 'gdl_back_office') . $color_menu_name, 'priority' => 1000 ) ); // add each color inside foreach( $goodlayers_element[$color_menu_slug] as $element_name => $element ){ if( !empty($element['name']) ){ $wp_customize->add_setting( $element['name'], array( 'default' => $element['default'], 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage' )); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, $element['name'] . '_id', array( 'label' => $element_name, 'section' => $color_menu_slug, 'settings' => $element['name'], 'priority' => $color_priority ))); $color_priority++; } } } // add the script of preview customization to the footer if ( $wp_customize->is_preview() && ! is_admin() ){ add_action( 'wp_footer', 'gdl_customize_preview', 21); } save_option(THEME_SHORT_NAME . '_stylesheet_generated', '', 'No'); } function gdl_customize_preview() { global $goodlayers_element, $goodlayers_menu; echo ''; } add_action('init', 'is_custom_style_generated'); function is_custom_style_generated(){ if( get_option(THEME_SHORT_NAME . '_stylesheet_generated') == 'No' ){ gdl_generate_style_custom(); save_option(THEME_SHORT_NAME . '_stylesheet_generated', 'No', ''); } } ?>