get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; // Logo Section $wp_customize->add_section('spyropress-logo-section', array( 'title' => __('Logo', 'spyropress'), 'priority' => 97, 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_setting('spyropress-logo', array( 'sanitize_callback' => 'spyropress_sanitize_text' )); $wp_customize->add_control( new WP_Customize_Image_Control($wp_customize, 'spyropress-logo', array( 'label' => __('Logo', 'spyropress'), 'section' => 'spyropress-logo-section', 'settings' => 'spyropress-logo' ))); // Social Networks $wp_customize->add_section('spyropress-social-section', array( 'title' => __('Contact section', 'spyropress'), 'priority' => 98, 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_setting('spyropress-twitter-social', array( 'sanitize_callback' => 'spyropress_sanitize_text', )); $wp_customize->add_control('spyropress-twitter-social', array( 'label' => __('Twitter Url', 'spyropress'), 'section' => 'spyropress-social-section', 'type' => 'text', 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_setting('spyropress-facebook-social', array( 'sanitize_callback' => 'spyropress_sanitize_text', )); $wp_customize->add_control('spyropress-facebook-social', array( 'label' => __('Facebook Url', 'spyropress'), 'section' => 'spyropress-social-section', 'type' => 'text', 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_setting('spyropress-google-social', array( 'sanitize_callback' => 'spyropress_sanitize_text', )); $wp_customize->add_control('spyropress-google-social', array( 'label' => __('Google Plus Url', 'spyropress'), 'section' => 'spyropress-social-section', 'type' => 'text', 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_setting('spyropress-dribbble-social', array( 'sanitize_callback' => 'spyropress_sanitize_text', )); $wp_customize->add_control('spyropress-dribbble-social', array( 'label' => __('Dribbble Url', 'spyropress'), 'section' => 'spyropress-social-section', 'type' => 'text', 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_setting('spyropress-skype-social', array( 'sanitize_callback' => 'spyropress_sanitize_text', )); $wp_customize->add_control('spyropress-skype-social', array( 'label' => __('Skype Url', 'spyropress'), 'section' => 'spyropress-social-section', 'type' => 'text', 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_setting('spyropress-rss-social', array( 'sanitize_callback' => 'spyropress_sanitize_text', )); $wp_customize->add_control('spyropress-rss-social', array( 'label' => __('RSS Url', 'spyropress'), 'section' => 'spyropress-social-section', 'type' => 'text', 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_setting('spyropress-phone-social', array( 'sanitize_callback' => 'spyropress_sanitize_text', )); $wp_customize->add_control('spyropress-phone-social', array( 'label' => __('Phone', 'spyropress'), 'section' => 'spyropress-social-section', 'type' => 'text', 'sanitize_callback' => 'spyropress_sanitize_number', )); // Footer Section $wp_customize->add_section('spyropress-footer-section', array( 'title' => __('Footer Section ', 'spyropress'), 'priority' => 99 )); $wp_customize->add_setting('spyropress-copy-social', array( 'sanitize_callback' => 'spyropress_sanitize_text', )); $wp_customize->add_control('spyropress-copy-social', array( 'label' => __('Copyright text', 'spyropress'), 'section' => 'spyropress-social-section', 'type' => 'text', 'sanitize_callback' => 'spyropress_sanitize_text', )); } add_action( 'customize_register', 'spyropress_customize_register' ); function spyropress_sanitize_text( $str ) { return sanitize_text_field( $str ); } function spyropress_sanitize_textarea( $text ) { return esc_textarea( $text ); } function spyropress_sanitize_number( $int ) { return absint( $int ); } function spyropress_sanitize_email( $email ) { if(is_email( $email )){ return $email; }else{ return ''; } } /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function spyropress_customize_preview_js() { wp_enqueue_script( 'spyropress_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20130508', true ); } add_action( 'customize_preview_init', 'spyropress_customize_preview_js' );