get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; /*********************************************************************************** * Sanitize Functions ***********************************************************************************/ function best_wp_sanitize_checkbox( $input ) { if ( $input ) { return 1; } return 0; } /***********************************************************************************/ function best_wp_sanitize_social( $input ) { $valid = array( '' => esc_attr__( ' ', 'best-wp' ), '_self' => esc_attr__( '_self', 'best-wp' ), '_blank' => esc_attr__( '_blank', 'best-wp' ), ); if ( array_key_exists( $input, $valid ) ) { return $input; } else { return ''; } } /******************************************** * Breadcrumb *********************************************/ $wp_customize->add_section( 'best_wp_premium_hide_section' , array( 'title' => __( 'Breadcrumb', 'best-wp' ), 'priority' => 70, ) ); $wp_customize->add_setting( 'best_wp_home_activate_breadcrumb', array ( 'sanitize_callback' => 'best_wp_sanitize_checkbox', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'best_wp_home_activate_breadcrumb', array( 'label' => __( 'Activate Breadcrumb', 'best-wp' ), 'section' => 'best_wp_premium_hide_section', 'settings' => 'best_wp_home_activate_breadcrumb', 'type' => 'checkbox', ) ) ); /*********************************************************************************** * Contacts ***********************************************************************************/ $wp_customize->add_section( 'best_wp_contacts_header' , array( 'title' => __( 'Header Contacts', 'best-wp' ), 'priority' => 65, ) ); $wp_customize->add_setting( 'best_wp_contacts_header_phone', array ( 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'best_wp_contacts_header_phone', array( 'label' => __( 'Phone Number', 'best-wp' ), 'description' => __(' Add content and activate the phone.', 'best-wp'), 'section' => 'best_wp_contacts_header', 'settings' => 'best_wp_contacts_header_phone', 'type' => 'text' ) ) ); $wp_customize->add_setting( 'best_wp_contacts_header_address', array ( 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'best_wp_contacts_header_address', array( 'label' => __( 'Address', 'best-wp' ), 'description' => __(' Add content and activate the address.', 'best-wp'), 'section' => 'best_wp_contacts_header', 'settings' => 'best_wp_contacts_header_address', 'type' => 'text' ) ) ); /*********************************************************************************** * Social media option ***********************************************************************************/ $wp_customize->add_section( 'best_wp_social_section' , array( 'title' => __( 'Social Media', 'best-wp' ), 'description' => __( 'Social media buttons', 'best-wp' ), 'priority' => 64, ) ); $wp_customize->add_setting( 'social_media_activate_header', array ( 'sanitize_callback' => 'best_wp_sanitize_checkbox', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'social_media_activate_header', array( 'label' => __( 'Activate Social Icons in Header:', 'best-wp' ), 'section' => 'best_wp_social_section', 'settings' => 'social_media_activate_header', 'type' => 'checkbox', ) ) ); $wp_customize->add_setting( 'social_media_activate', array ( 'sanitize_callback' => 'best_wp_sanitize_checkbox', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'social_media_activate', array( 'label' => __( 'Activate Social Icons in Footer:', 'best-wp' ), 'section' => 'best_wp_social_section', 'settings' => 'social_media_activate', 'type' => 'checkbox', ) ) ); $wp_customize->add_setting( 'best_wp_social_link_type', array ( 'sanitize_callback' => 'best_wp_sanitize_social', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'best_wp_social_link_type', array( 'label' => __( 'Link Type', 'best-wp' ), 'section' => 'best_wp_social_section', 'settings' => 'best_wp_social_link_type', 'type' => 'select', 'choices' => array( '' => esc_attr__( ' ', 'best-wp' ), '_self' => esc_attr__( '_self', 'best-wp' ), '_blank' => esc_attr__( '_blank', 'best-wp' ), ), ) ) ); $wp_customize->add_setting( 'social_media_color', array ( 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'social_media_color', array( 'label' => __( 'Social Icons Color:', 'best-wp' ), 'section' => 'best_wp_social_section', 'settings' => 'social_media_color', ) ) ); $wp_customize->add_setting( 'social_media_hover_color', array ( 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'social_media_hover_color', array( 'label' => __( 'Social Hover Icons Color:', 'best-wp' ), 'section' => 'best_wp_social_section', 'settings' => 'social_media_hover_color', ) ) ); $wp_customize->add_setting( 'best_wp_facebook', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'best_wp_facebook', array( 'label' => __( 'Enter Facebook url', 'best-wp' ), 'section' => 'best_wp_social_section', 'settings' => 'best_wp_facebook', ) ) ); $wp_customize->add_setting( 'best_wp_twitter', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'best_wp_twitter', array( 'label' => __( 'Enter Twitter url', 'best-wp' ), 'section' => 'best_wp_social_section', 'settings' => 'best_wp_twitter', ) ) ); $wp_customize->add_setting( 'best_wp_google', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'best_wp_google', array( 'label' => __( 'Enter Google+ url', 'best-wp' ), 'section' => 'best_wp_social_section', 'settings' => 'best_wp_google', ) ) ); /******************************************** * Footer Options *********************************************/ $wp_customize->add_section( 'footer_options' , array( 'title' => __( 'Footer Copyright', 'best-wp' ), 'priority' => 70, ) ); /******************************************** Footer Deactivat *********************************************/ $wp_customize->add_setting( 'best_wp_premium_copyright1', array( 'default' => '', 'sanitize_callback' => 'wp_kses' )); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'best_wp_premium_copyright1', array( 'label' => __( 'Custom Copyright Text', 'best-wp' ), 'section' => 'footer_options', 'settings' => 'best_wp_premium_copyright1', 'type' => 'textarea' ) ) ); } add_action( 'customize_register', 'best_wp_customize_register' ); /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function best_wp_customize_preview_js() { wp_enqueue_script( 'best_wp_customizer', get_template_directory_uri() . '/framework/js/customizer.js', array( 'customize-preview' ), '20151215', true ); } add_action( 'customize_preview_init', 'best_wp_customize_preview_js' ); function best_wp_customize_all_css() { ?>