$v ){ $wp_customize->add_panel( $k ,array( 'title' => $v, 'priority' => 30, )); $priority++; }// end panels $wp_customize->get_section( 'colors' )->panel = 'general_panel'; $wp_customize->get_section( 'header_image' )->panel = 'general_panel'; $wp_customize->get_section( 'background_image' )->panel = 'general_panel'; /* making section for panels */ $spriority = 1; foreach( $hpSections as $sk => $sections ){ foreach( $sections as $key => $value ){ $wp_customize->add_section( $key , array( 'title' => $value, 'panel' => $sk, 'priority' => $spriority, ) ); $spriority++; } }// end sections /* making start theme settings */ foreach( $hpSettings as $sectionk => $settings_arg ){ foreach( $settings_arg as $key => $value ){ $wp_customize->add_setting( "book_land_option[$key]" , array( 'default' => $option[$key], 'sanitize_callback' => (isset($value['sanitize_callback']) ? $value['sanitize_callback'] :'sanitize_text_field'), 'type'=>'option' ) ); $control_arg = array( 'label' => $value['label'], 'description' => $value['desc'], 'section' => $sectionk, 'type'=> $value['type'], ); if( isset( $value['choices'] ) ){ $control_arg['choices'] = $value['choices']; } $type = $value['type']; switch($type){ case 'theme_color': $value['type'] = 'radio'; break; case 'color_alpha': $value['type'] = ''; break; } switch($type){ case 'theme_color': $wp_customize->add_control( new book_land_Theme_Color_Customize_Control($wp_customize,"book_land_option[$key]", $control_arg ) ); break; case 'image': $wp_customize->add_control( new WP_Customize_Image_Control($wp_customize,"book_land_option[$key]", $control_arg ) ); break; case 'color': $control_arg['settings'] = "book_land_option[$key]"; $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize ,"book_land_option[$key]", $control_arg ) ); break; case 'color_alpha': $wp_customize->add_control( new book_land_Alpha_Color_Control($wp_customize,"book_land_option[$key]", array( 'label' => $value['label'], 'description' => $value['desc'], 'section' => $sectionk, ) ) ); break; case 'theme_textarea': $wp_customize->add_control( new book_land_Editor_Custom_Control($wp_customize,"book_land_option[$key]", array( 'label' => $value['label'], 'description' => $value['desc'], 'section' => $sectionk, ) ) ); break; case 'theme_repeater': $r_arg = array( 'label' => $value['label'], 'description' => $value['desc'], 'section' => $sectionk, 'title_format' => $value['title_format'], 'max_item' => $value['max_item'], 'fields' => $value['fields'], ); if( isset( $value['live_title_id'] ) ){ $r_arg['live_title_id'] = $value['live_title_id']; } if( isset( $value['limited_msg'] ) ){ $r_arg['limited_msg'] = $value['limited_msg']; } $wp_customize->add_control( new book_land_Customize_Repeatable_Control($wp_customize,"book_land_option[$key]", $r_arg ) ); break; case 'theme_category': $c_arg = array( 'label' => $value['label'], 'description' => $value['desc'], 'section' => $sectionk, ); $wp_customize->add_control( new book_land_Category_Control($wp_customize,"book_land_option[$key]", $c_arg ) ); break; default: $wp_customize->add_control( "book_land_option[$key]" , $control_arg ); } } } // end settings } add_action( 'customize_register', 'book_land_theme_options' );