add_panel( 'gtl_header_panel', array( 'priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __('Header Setting', 'business-curve'), ) ); // header type $wp_customize->add_section( 'gtl_header_type', array( 'title' => __('Header type', 'business-curve'), 'priority' => 10, 'panel' => 'gtl_header_panel', ) ); // menu style $wp_customize->add_section( 'gtl_menu_type', array( 'title' => __('Header style', 'business-curve'), 'priority' => 99, 'panel' => 'gtl_header_panel', ) ); // sticky menu $wp_customize->add_setting( 'menu_type', array( 'default' => 'sticky-header', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'gtl_sanitize_header_type', ) ); $wp_customize->add_control( 'menu_type', array( 'type' => 'radio', 'priority' => 10, 'label' => __('Header type', 'business-curve'), 'description' => __('Works with full width and boxed layout' , 'business-curve'), 'section' => 'gtl_menu_type', 'choices' => array( 'sticky-header' => __('Sticky', 'business-curve'), 'static-header' => __('Static', 'business-curve'), 'absolute-header' => __('Absolute', 'business-curve'), 'fixed-header' => __('Fixed', 'business-curve'), ), ) ); // menu display type $wp_customize->add_setting( 'menu_display', array( 'default' => 'menu-inline', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'gtl_sanitize_menu_display', ) ); $wp_customize->add_control( 'menu_display', array( 'type' => 'radio', 'priority' => 11, 'label' => __('Menu display', 'business-curve'), 'description'=>__('Works with full width and boxed layout' , 'business-curve'), 'section' => 'gtl_menu_type', 'choices' => array( 'menu-inline' => __('Inline', 'business-curve'), 'menu-center' => __('Centered', 'business-curve'), ), ) ); /** * Sanitazation */ // menu type function gtl_sanitize_header_type( $input ) { $valid = array( 'sticky-header' => __('Sticky', 'business-curve'), 'static-header' => __('Static', 'business-curve'), 'absolute-header' => __('Absolute', 'business-curve'), 'fixed-header' => __('Fixed', 'business-curve'), ); if ( array_key_exists( $input, $valid ) ) { return $input; } else { return ''; } } // menu display type function gtl_sanitize_menu_display( $input ) { $valid = array( 'menu-inline' => __('Inline', 'business-curve'), 'menu-center' => __('Centered', 'business-curve'), ); if ( array_key_exists( $input, $valid ) ) { return $input; } else { return ''; } }