add_section( new bigbang_Hiding_Section( $wp_customize, 'bigbang_shop', array( 'title' => esc_html__( 'Shop', 'bigbang' ), 'panel' => 'bigbang_frontpage_sections', 'priority' => apply_filters( 'bigbang_section_priority', 20, 'bigbang_shop' ), 'hiding_control' => 'bigbang_shop_hide', ) ) ); } else { $wp_customize->add_section( 'bigbang_shop', array( 'title' => esc_html__( 'Shop', 'bigbang' ), 'panel' => 'bigbang_frontpage_sections', 'priority' => apply_filters( 'bigbang_section_priority', 20, 'bigbang_shop' ), ) ); } $selective_refresh = isset( $wp_customize->selective_refresh ) ? 'postMessage' : 'refresh'; $wp_customize->add_setting( 'bigbang_shop_hide', array( 'sanitize_callback' => 'bigbang_sanitize_checkbox', 'default' => false, 'transport' => $selective_refresh, ) ); $wp_customize->add_control( 'bigbang_shop_hide', array( 'type' => 'checkbox', 'label' => esc_html__( 'Disable section', 'bigbang' ), 'section' => 'bigbang_shop', 'priority' => 1, ) ); $wp_customize->add_setting( 'bigbang_shop_title', array( 'default' => esc_html__( 'Products', 'bigbang' ), 'sanitize_callback' => 'wp_kses_post', 'transport' => $selective_refresh, ) ); $wp_customize->add_control( 'bigbang_shop_title', array( 'label' => esc_html__( 'Section Title', 'bigbang' ), 'section' => 'bigbang_shop', 'priority' => 5, ) ); $wp_customize->add_setting( 'bigbang_shop_subtitle', array( 'default' => esc_html__( 'Change this subtitle in the Customizer', 'bigbang' ), 'sanitize_callback' => 'wp_kses_post', 'transport' => $selective_refresh, ) ); $wp_customize->add_control( 'bigbang_shop_subtitle', array( 'label' => esc_html__( 'Section Subtitle', 'bigbang' ), 'section' => 'bigbang_shop', 'priority' => 10, ) ); $wp_customize->add_setting( 'bigbang_shop_items', array( 'default' => 4, 'sanitize_callback' => 'absint', 'transport' => $selective_refresh, ) ); $wp_customize->add_control( 'bigbang_shop_items', array( 'label' => esc_html__( 'Number of Items', 'bigbang' ), 'section' => 'bigbang_shop', 'priority' => 15, 'type' => 'number', ) ); } add_action( 'customize_register', 'bigbang_shop_customize_register' ); /** * Add selective refresh for shop section controls. * * @param WP_Customize_Manager $wp_customize Theme Customizer object. * @since 1.1.31 * @access public */ function bigbang_register_shop_partials( $wp_customize ) { // Abort if selective refresh is not available. if ( ! isset( $wp_customize->selective_refresh ) ) { return; } $wp_customize->selective_refresh->add_partial( 'bigbang_shop_items', array( 'selector' => '.bigbang-shop .bigbang-shop-content', 'render_callback' => 'bigbang_shop_content', 'container_inclusive' => true, ) ); } add_action( 'customize_register', 'bigbang_register_shop_partials' );