get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title a', 'render_callback' => 'amike_lite_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'amike_lite_customize_partial_blogdescription', ) ); } /** * Primary color. */ $wp_customize->add_setting( 'primary_color', array( 'default' => '#ff4a57', 'transport' => 'refresh', 'sanitize_callback' => 'sanitize_hex_color' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'primary_color', array( 'description' => __( 'Primary Color', 'amike-lite' ), 'section' => 'colors' ) ) ); // General $wp_customize->add_section( 'general' , array( 'title' => __( 'General', 'amike-lite' ), 'priority' => 30, ) ); // Add image filter setting and control. $wp_customize->add_setting( 'preloader', array( 'default' => 1, 'transport' => 'refresh', 'sanitize_callback' => 'amike_lite_sanitize_checkbox' ) ); $wp_customize->add_control( 'preloader', array( 'label' => __( 'Preloader', 'amike-lite' ), 'section' => 'general', 'type' => 'checkbox', ) ); // Blog $wp_customize->add_section( 'blog' , array( 'title' => __( 'Blog', 'amike-lite' ), 'priority' => 30, ) ); // Add image filter setting and control. $wp_customize->add_setting( 'blog_title', array( 'default' => esc_html__( 'Latest Blog', 'amike-lite' ), 'transport' => 'refresh', 'sanitize_callback' => 'wp_filter_nohtml_kses' ) ); $wp_customize->add_control( 'blog_title', array( 'label' => __( 'Breadcrumb Title', 'amike-lite' ), 'section' => 'blog', 'type' => 'text', ) ); // Add image filter setting and control. $wp_customize->add_setting( 'excerpt_length', array( 'default' => 32, 'transport' => 'refresh', 'sanitize_callback' => 'absint' ) ); $wp_customize->add_control( 'excerpt_length', array( 'label' => __( 'Excerpt Length', 'amike-lite' ), 'section' => 'blog', 'type' => 'number', ) ); // Add image filter setting and control. $wp_customize->add_setting( 'post_navigation', array( 'default' => 1, 'transport' => 'refresh', 'sanitize_callback' => 'amike_lite_sanitize_checkbox' ) ); $wp_customize->add_control( 'post_navigation', array( 'label' => esc_html__( 'Post Navigation (Next/Previous)', 'amike-lite' ), 'section' => 'blog', 'type' => 'checkbox', ) ); // Footer $wp_customize->add_section( 'footer' , array( 'title' => __( 'Footer', 'amike-lite' ), 'priority' => 30, ) ); //filter setting and control. $wp_customize->add_setting( 'footer_top', array( 'default' => 1, 'transport' => 'refresh', 'sanitize_callback' => 'amike_lite_sanitize_checkbox' ) ); $wp_customize->add_control( 'footer_top', array( 'label' => __( 'Footer top', 'amike-lite' ), 'section' => 'footer', 'type' => 'checkbox', ) ); //filter setting and control. $wp_customize->add_setting( 'footer_logo', array( 'default' => 1, 'transport' => 'refresh', 'sanitize_callback' => 'amike_lite_sanitize_checkbox' ) ); $wp_customize->add_control( 'footer_logo', array( 'label' => __( 'Footer logo', 'amike-lite' ), 'section' => 'footer', 'type' => 'checkbox', ) ); //filter setting and control. $wp_customize->add_setting( 'footer_text', array( 'default' => esc_html__( 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor inci- didunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exe- rcitation ullamco laboris nisi ut aliquip ex ea commodo consequat.', 'amike-lite' ), 'transport' => 'refresh', 'sanitize_callback' => 'wp_filter_nohtml_kses' ) ); $wp_customize->add_control( 'footer_text', array( 'label' => __( 'Footer text', 'amike-lite' ), 'section' => 'footer', 'type' => 'textarea', ) ); //filter setting and control. $wp_customize->add_setting( 'copyright_info', array( 'default' => esc_html__( 'Copyright 2020 All right reserved by ThemeBing', 'amike-lite' ), 'transport' => 'refresh', 'sanitize_callback' => 'wp_filter_nohtml_kses' ) ); $wp_customize->add_control( 'copyright_info', array( 'label' => __( 'Footer text', 'amike-lite' ), 'section' => 'footer', 'type' => 'textarea', ) ); //filter setting and control. $wp_customize->add_setting( 'footer_facebook', array( 'default' => '#', 'transport' => 'refresh', 'sanitize_callback' => 'wp_filter_nohtml_kses' ) ); $wp_customize->add_control( 'footer_facebook', array( 'label' => __( 'Facebook', 'amike-lite' ), 'section' => 'footer', 'type' => 'text', ) ); //filter setting and control. $wp_customize->add_setting( 'footer_twitter', array( 'default' => '#', 'transport' => 'refresh', 'sanitize_callback' => 'wp_filter_nohtml_kses' ) ); $wp_customize->add_control( 'footer_twitter', array( 'label' => __( 'Twitter', 'amike-lite' ), 'section' => 'footer', 'type' => 'text', ) ); //filter setting and control. $wp_customize->add_setting( 'footer_instagram', array( 'default' => '#', 'transport' => 'refresh', 'sanitize_callback' => 'wp_filter_nohtml_kses' ) ); $wp_customize->add_control( 'footer_instagram', array( 'label' => __( 'Instagram', 'amike-lite' ), 'section' => 'footer', 'type' => 'text', ) ); //filter setting and control. $wp_customize->add_setting( 'footer_pinterest', array( 'default' => '#', 'transport' => 'refresh', 'sanitize_callback' => 'wp_filter_nohtml_kses' ) ); $wp_customize->add_control( 'footer_pinterest', array( 'label' => __( 'Pinterest', 'amike-lite' ), 'section' => 'footer', 'type' => 'text', ) ); // 404 $wp_customize->add_section( '404' , array( 'title' => __( '404', 'amike-lite' ), 'priority' => 30, ) ); //filter setting and control. $wp_customize->add_setting( 'error_title', array( 'default' => esc_html__( 'Oops! That page can’t be found.', 'amike-lite' ), 'transport' => 'refresh', 'sanitize_callback' => 'wp_filter_nohtml_kses' ) ); $wp_customize->add_control( 'error_title', array( 'label' => __( 'Error title', 'amike-lite' ), 'section' => '404', 'type' => 'text', ) ); //filter setting and control. $wp_customize->add_setting( 'error_text', array( 'default' => esc_html__( 'It looks like nothing was found at this location. Maybe try one of the links below or a search?', 'amike-lite' ), 'transport' => 'refresh', 'sanitize_callback' => 'wp_filter_nohtml_kses' ) ); $wp_customize->add_control( 'error_text', array( 'label' => __( 'Error message', 'amike-lite' ), 'section' => '404', 'type' => 'textarea', ) ); } add_action( 'customize_register', 'amike_lite_customize_register' ); //checkbox sanitization function function amike_lite_sanitize_checkbox( $input ){ //returns true if checkbox is checked return ( isset( $input ) ? true : false ); } /** * Render the site title for the selective refresh partial. * * @return void */ function amike_lite_customize_partial_blogname() { bloginfo( 'name' ); } /** * Render the site tagline for the selective refresh partial. * * @return void */ function amike_lite_customize_partial_blogdescription() { bloginfo( 'description' ); } // Binds JS handlers to make Theme Customizer preview reload changes asynchronously. function amike_lite_customize_preview_js() { wp_enqueue_script( 'amike_lite-customizer', get_theme_file_uri('/js/customizer.js') , array( 'customize-preview' ), '20151215', true ); } add_action( 'customize_preview_init', 'amike_lite_customize_preview_js' ); /** * Load dynamic logic for the customizer controls area. */ function amike_lite_panels_js() { wp_enqueue_script( 'amike_lite-customize-controls', get_theme_file_uri( '/js/customize-controls.js' ), array(), '20151215', true ); } add_action( 'customize_controls_enqueue_scripts', 'amike_lite_panels_js' );