add_panel( 'gtl_sidebar_panel', array( 'priority' => 11, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __('Sidebar Setting', 'business-curve'), ) ); // post sidebar position $wp_customize->add_section( 'gtl_sidebar_panel', array( 'title' => __('Post sidebar', 'business-curve'), 'priority' => 10, 'panel' => 'gtl_sidebar_panel', ) ); // post archive sidebar position $wp_customize->add_setting( 'post_arhive_sidebar_pos', array( 'default' => 'right', 'sanitize_callback' => 'gtl_sanitize_sidebar', ) ); $wp_customize->add_control( 'post_arhive_sidebar_pos', array( 'type' => 'radio', 'label' => __('Post archive sidebar position', 'business-curve'), 'section' => 'gtl_sidebar_panel', 'description' => __('Select the sidebar position for post index/archive templates', 'business-curve'), 'choices' => array( 'none' => __('No sidebar', 'business-curve'), 'right' => __('Right sidebar', 'business-curve'), 'left'=> __('Left sidebar', 'business-curve') ), ) ); // post single sidebar posistion $wp_customize->add_setting( 'post_single_sidebar_type', array( 'default' => 'right', 'sanitize_callback' => 'gtl_sanitize_sidebar', ) ); $wp_customize->add_control( 'post_single_sidebar_type', array( 'type' => 'radio', 'label' => __('Post single sidebar position', 'business-curve'), 'section' => 'gtl_sidebar_panel', 'description' => __('Select the sidebar position for post single templates', 'business-curve'), 'choices' => array( 'none' => __('No sidebar', 'business-curve'), 'right' => __('Right sidebar', 'business-curve'), 'left'=> __('Left sidebar', 'business-curve') ), ) ); // post sidebar id $wp_customize->add_setting( 'post_sidebar_id', array( 'default' => 'sidebar-1', 'sanitize_callback' => 'gtl_sanitize_sidebar_id', ) ); $wp_customize->add_control( 'post_sidebar_id', array( 'type' => 'radio', 'label' => __('Select sidebar', 'business-curve'), 'section' => 'gtl_sidebar_panel', 'description' => __('Select sidebar for post archive/single pages. Will ignored if No sidebar is checked above', 'business-curve'), 'choices' => business_curve_sidebars(), ) ); // page sidebar position $wp_customize->add_section( 'gtl_page_sidebar_panel', array( 'title' => __('Page sidebar', 'business-curve'), 'priority' => 10, 'panel' => 'gtl_sidebar_panel', ) ); $wp_customize->add_setting( 'page_sidebar_pos', array( 'default' => 'right', 'sanitize_callback' => 'gtl_sanitize_sidebar', ) ); $wp_customize->add_control( 'page_sidebar_pos', array( 'type' => 'radio', 'label' => __('Page sidebar position', 'business-curve'), 'section' => 'gtl_page_sidebar_panel', 'description' => __('Select the sidebar position for pages', 'business-curve'), 'choices' => array( 'none' => __('No sidebar', 'business-curve'), 'right' => __('Right sidebar', 'business-curve'), 'left'=> __('Left sidebar', 'business-curve') ), ) ); // page sidebar id $wp_customize->add_setting( 'page_sidebar_id', array( 'default' => 'sidebar-1', 'sanitize_callback' => 'gtl_sanitize_sidebar_id', ) ); $wp_customize->add_control( 'page_sidebar_id', array( 'type' => 'radio', 'label' => __('Select sidebar', 'business-curve'), 'section' => 'gtl_page_sidebar_panel', 'description' => __('Select sidebar for pages. Will ignored if No sidebar is checked above', 'business-curve'), 'choices' => business_curve_sidebars(), ) ); // shop sidebar position $wp_customize->add_section( 'gtl_shop_sidebar_panel', array( 'title' => __('Shop sidebar', 'business-curve'), 'priority' => 11, 'panel' => 'gtl_sidebar_panel', ) ); $wp_customize->add_setting( 'shop_sidebar_pos', array( 'default' => 'right', 'sanitize_callback' => 'gtl_sanitize_sidebar', ) ); $wp_customize->add_control( 'shop_sidebar_pos', array( 'type' => 'radio', 'label' => __('Shop sidebar position', 'business-curve'), 'section' => 'gtl_shop_sidebar_panel', 'description' => __('Select the sidebar position for shop archive/single templates', 'business-curve'), 'choices' => array( 'none' => __('No sidebar', 'business-curve'), 'right' => __('Right sidebar', 'business-curve'), 'left'=> __('Left sidebar', 'business-curve') ), ) ); // shop sidebar id $wp_customize->add_setting( 'shop_sidebar_id', array( 'default' => 'sidebar-1', 'sanitize_callback' => 'gtl_sanitize_sidebar_id', ) ); $wp_customize->add_control( 'shop_sidebar_id', array( 'type' => 'radio', 'label' => __('Select sidebar', 'business-curve'), 'section' => 'gtl_shop_sidebar_panel', 'description' => __('Select sidebar for shop archive/single teamplates. Will ignored if No sidebar is checked above', 'business-curve'), 'choices' => business_curve_sidebars(), ) ); /** * Sanitazation */ // sidebar position function gtl_sanitize_sidebar( $input ) { $valid = array( 'none' => __('No sidebar', 'business-curve'), 'right' => __('Right sidebar', 'business-curve'), 'left'=> __('Left sidebar', 'business-curve') ); if ( array_key_exists( $input, $valid ) ) { return $input; } else { return ''; } } // sidebar id function gtl_sanitize_sidebar_id( $input ) { $valid = business_curve_sidebars(); if ( array_key_exists( $input, $valid ) ) { return $input; } else { return ''; } }