selective_refresh ) ? 'postMessage' : 'refresh'; /*========================================= Funfact Section =========================================*/ $wp_customize->add_section( 'funfact_setting', array( 'title' => esc_html__( 'Funfact Section', 'artech' ), 'priority' => 9, 'panel' => 'artech_frontpage_sections', ) ); // Funfact content Section // $wp_customize->add_setting( 'funfact_content_head' ,array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'artech_sanitize_text', 'priority' => 7, ) ); $wp_customize->add_control( 'funfact_content_head', array( 'type' => 'hidden', 'label' => __('Content','artech'), 'section' => 'funfact_setting', ) ); /** * Customizer Repeater for add funfact */ $wp_customize->add_setting( 'funfact_contents', array( 'sanitize_callback' => 'artech_repeater_sanitize', 'transport' => $selective_refresh, 'priority' => 8, 'default' => artech_get_funfact_default() ) ); $wp_customize->add_control( new Artech_Repeater( $wp_customize, 'funfact_contents', array( 'label' => esc_html__('Funfact','artech'), 'section' => 'funfact_setting', 'add_field_label' => esc_html__( 'Add New Funfact', 'artech' ), 'item_name' => esc_html__( 'Funfact', 'artech' ), 'customizer_repeater_icon_control' => true, 'customizer_repeater_image_control' => true, 'customizer_repeater_title_control' => true, 'customizer_repeater_subtitle_control' => true, ) ) ); //Pro feature class Artech_funfact__section_upgrade extends WP_Customize_Control { public function artech_render_content() { ?> add_setting( 'Artech_funfact_upgrade_to_pro', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_filter_nohtml_kses', 'priority' => 5, )); $wp_customize->add_control( new Artech_funfact__section_upgrade( $wp_customize, 'Artech_funfact_upgrade_to_pro', array( 'section' => 'funfact_setting', 'settings' => 'Artech_funfact_upgrade_to_pro', ) ) ); } add_action( 'customize_register', 'artech_funfact_setting' ); // funfact selective refresh function artech_home_funfact_section_partials( $wp_customize ){ // funfact title $wp_customize->selective_refresh->add_partial( 'funfact_title', array( 'selector' => '.home-funfact .section-title h5', 'settings' => 'funfact_title', 'render_callback' => 'artech_funfact_title_render_callback', ) ); // funfact_subtitle $wp_customize->selective_refresh->add_partial( 'funfact_subtitle', array( 'selector' => '.home-funfact .section-title span.subtitle', 'settings' => 'funfact_subtitle', 'render_callback' => 'artech_funfact_subtitle_render_callback', ) ); // funfact content $wp_customize->selective_refresh->add_partial( 'funfact_contents', array( 'selector' => '.home-funfact .funfact-box' ) ); } add_action( 'customize_register', 'artech_home_funfact_section_partials' ); // funfact title function artech_funfact_title_render_callback() { return get_theme_mod( 'funfact_title' ); } // funfact_subtitle function artech_funfact_subtitle_render_callback() { return get_theme_mod( 'funfact_subtitle' ); }