selective_refresh ) ? 'postMessage' : 'refresh'; if ( class_exists( 'bigbang_Hiding_Section' ) ) { $wp_customize->add_section( new bigbang_Hiding_Section( $wp_customize, 'bigbang_blog', array( 'title' => esc_html__( 'Blog', 'bigbang' ), 'panel' => 'bigbang_frontpage_sections', 'priority' => apply_filters( 'bigbang_section_priority', 60, 'bigbang_blog' ), 'hiding_control' => 'bigbang_blog_hide', ) ) ); } else { $wp_customize->add_section( 'bigbang_blog', array( 'title' => esc_html__( 'Blog', 'bigbang' ), 'panel' => 'bigbang_frontpage_sections', 'priority' => apply_filters( 'bigbang_section_priority', 60, 'bigbang_blog' ), ) ); } $wp_customize->add_setting( 'bigbang_blog_hide', array( 'sanitize_callback' => 'bigbang_sanitize_checkbox', 'default' => false, 'transport' => $selective_refresh, ) ); $wp_customize->add_control( 'bigbang_blog_hide', array( 'type' => 'checkbox', 'label' => esc_html__( 'Disable section', 'bigbang' ), 'section' => 'bigbang_blog', 'priority' => 1, ) ); $wp_customize->add_setting( 'bigbang_blog_title', array( 'default' => esc_html__( 'Blog', 'bigbang' ), 'sanitize_callback' => 'wp_kses_post', 'transport' => $selective_refresh, ) ); $wp_customize->add_control( 'bigbang_blog_title', array( 'label' => esc_html__( 'Section Title', 'bigbang' ), 'section' => 'bigbang_blog', 'priority' => 5, ) ); $wp_customize->add_setting( 'bigbang_blog_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_blog_subtitle', array( 'label' => esc_html__( 'Section Subtitle', 'bigbang' ), 'section' => 'bigbang_blog', 'priority' => 10, ) ); $wp_customize->add_setting( 'bigbang_blog_items', array( 'default' => 3, 'sanitize_callback' => 'absint', 'transport' => $selective_refresh, ) ); $wp_customize->add_control( 'bigbang_blog_items', array( 'label' => esc_html__( 'Number of Items', 'bigbang' ), 'section' => 'bigbang_blog', 'priority' => 15, 'type' => 'number', ) ); } add_action( 'customize_register', 'bigbang_blog_customize_register' ); /** * Add selective refresh for blog section controls. * * @param WP_Customize_Manager $wp_customize Theme Customizer object. * @since 1.1.31 * @access public */ function bigbang_register_blog_partials( $wp_customize ) { // Abort if selective refresh is not available. if ( ! isset( $wp_customize->selective_refresh ) ) { return; } $wp_customize->selective_refresh->add_partial( 'bigbang_blog_items', array( 'selector' => '.bigbang-blog-content', 'settings' => 'bigbang_blog_items', 'render_callback' => 'bigbang_blog_content_callback', ) ); } add_action( 'customize_register', 'bigbang_register_blog_partials' ); /** * Callback function for blog content selective refresh. * * @since 1.1.31 * @access public */ function bigbang_blog_content_callback() { bigbang_blog_content( true ); }