selective_refresh ) ? 'postMessage' : 'refresh'; /*========================================= Blog Section =========================================*/ $wp_customize->add_section( 'blog_setting', array( 'title' => esc_html__( 'Blog Section', 'artech' ), 'priority' => 10, 'panel' => 'artech_frontpage_sections', ) ); // Blog Header Section // $wp_customize->add_setting( 'blog_headings' ,array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'artech_sanitize_text', 'priority' => 3, ) ); $wp_customize->add_control( 'blog_headings', array( 'type' => 'hidden', 'label' => __('Header','artech'), 'section' => 'blog_setting', ) ); // Blog Title // $wp_customize->add_setting( 'blog_title', array( 'default' => __('Our Blog','artech'), 'capability' => 'edit_theme_options', 'sanitize_callback' => 'artech_sanitize_html', 'priority' => 4, ) ); $wp_customize->add_control( 'blog_title', array( 'label' => __('Title','artech'), 'section' => 'blog_setting', 'type' => 'text', ) ); // Blog Subtitle // $wp_customize->add_setting( 'blog_subtitle', array( 'default' => __('Outstanding Blog','artech'), 'capability' => 'edit_theme_options', 'sanitize_callback' => 'artech_sanitize_html', 'priority' => 5, ) ); $wp_customize->add_control( 'blog_subtitle', array( 'label' => __('Subtitle','artech'), 'section' => 'blog_setting', 'type' => 'text', ) ); // Blog content Section // $wp_customize->add_setting( 'blog_content_head' ,array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'artech_sanitize_text', 'priority' => 7, ) ); $wp_customize->add_control( 'blog_content_head', array( 'type' => 'hidden', 'label' => __('Content','artech'), 'section' => 'blog_setting', ) ); // blog_display_num if ( class_exists( 'Artech_Customizer_Range_Control' ) ) { $wp_customize->add_setting( 'blog_display_num', array( 'default' => '5', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'artech_sanitize_range_value', 'priority' => 8, ) ); $wp_customize->add_control( new Artech_Customizer_Range_Control( $wp_customize, 'blog_display_num', array( 'label' => __( 'No of Posts Display', 'artech' ), 'section' => 'blog_setting', 'media_query' => false, 'input_attr' => array( 'desktop' => array( 'min' => 1, 'max' => 500, 'step' => 1, 'default_value' => 5, ), ), ) ) ); } // Enable Excerpt $wp_customize->add_setting( 'enable_post_excerpt' ,array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'artech_sanitize_checkbox', 'priority' => 9, ) ); $wp_customize->add_control( 'enable_post_excerpt', array( 'type' => 'checkbox', 'label' => __('Enable Excerpt','artech'), 'section' => 'blog_setting', ) ); // post Exerpt // if ( class_exists( 'Artech_Customizer_Range_Control' ) ) { $wp_customize->add_setting( 'artech_post_excerpt', array( 'default' => '30', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'artech_sanitize_range_value', 'priority' => 10, ) ); $wp_customize->add_control( new Artech_Customizer_Range_Control( $wp_customize, 'artech_post_excerpt', array( 'label' => __( 'Excerpt Length', 'artech' ), 'section' => 'blog_setting', 'media_query' => false, 'input_attr' => array( 'desktop' => array( 'min' => 0, 'max' => 1000, 'step' => 1, 'default_value' => 30, ), ) ) ) ); } // excerpt more // $wp_customize->add_setting( 'artech_blog_excerpt_more', array( 'default' => '...', 'sanitize_callback' => 'sanitize_text_field', 'capability' => 'edit_theme_options', 'priority' => 11, ) ); $wp_customize->add_control( 'artech_blog_excerpt_more', array( 'label' => esc_html__('Excerpt More','artech'), 'section' => 'blog_setting', 'type' => 'text', ) ); // Enable Excerpt $wp_customize->add_setting( 'enable_post_btn' ,array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'artech_sanitize_checkbox', 'priority' => 12, ) ); $wp_customize->add_control( 'enable_post_btn', array( 'type' => 'checkbox', 'label' => __('Enable Read More Button','artech'), 'section' => 'blog_setting', ) ); // Readmore button $wp_customize->add_setting( 'read_btn_txt' ,array( 'default' => __('Read more','artech'), 'capability' => 'edit_theme_options', 'sanitize_callback' => 'artech_sanitize_html', 'priority' => 13, ) ); $wp_customize->add_control( 'read_btn_txt', array( 'type' => 'text', 'label' => __('Read More Button Text','artech'), 'section' => 'blog_setting', ) ); } add_action( 'customize_register', 'artech_blog_setting' ); // blog selective refresh function artech_home_blog_section_partials( $wp_customize ){ // blog title $wp_customize->selective_refresh->add_partial( 'blog_title', array( 'selector' => '.post-home .section-title h2', 'settings' => 'blog_title', 'render_callback' => 'artech_blog_title_render_callback', ) ); // blog_subtitle $wp_customize->selective_refresh->add_partial( 'blog_subtitle', array( 'selector' => '.post-home .section-title span.sub-title', 'settings' => 'blog_subtitle', 'render_callback' => 'artech_blog_subtitle_render_callback', ) ); } add_action( 'customize_register', 'artech_home_blog_section_partials' ); // blog title function artech_blog_title_render_callback() { return get_theme_mod( 'blog_title' ); } // blog_subtitle function artech_blog_subtitle_render_callback() { return get_theme_mod( 'blog_subtitle' ); }