get_setting( 'blogname' )->transport = 'postMessage'; /** * Set priority of blogname (Site Title) to 1. * Strangly, if more than two options is added, Site title is moved below Tagline. This rectifies this issue. */ $wp_customize->get_control( 'blogname' )->priority = 1; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $options = automobile_get_theme_options(); $defaults = automobile_get_default_theme_options(); //Custom Controls require get_template_directory() . '/inc/customizer-includes/custom-controls.php'; // Move Site Title and Tagline (added to Site Title and Tagline section in Theme Customizer) $wp_customize->add_setting( 'automobile_theme_options[move_title_tagline]', array( 'capability' => 'edit_theme_options', 'default' => $defaults['move_title_tagline'], 'sanitize_callback' => 'automobile_sanitize_checkbox', ) ); $wp_customize->add_control( 'automobile_theme_options[move_title_tagline]', array( 'label' => __( 'Check to move Site Title and Tagline before logo', 'automobile' ), 'priority' => 103, 'section' => 'title_tagline', 'settings' => 'automobile_theme_options[move_title_tagline]', 'type' => 'checkbox', ) ); // Custom Logo End // Header Options (added to Header section in Theme Customizer) require get_template_directory() . '/inc/customizer-includes/header-options.php'; //Theme Options require get_template_directory() . '/inc/customizer-includes/theme-options.php'; //Header Highlight Content require get_template_directory() . '/inc/customizer-includes/header-highlight-content.php'; //Featured Content Setting require get_template_directory() . '/inc/customizer-includes/featured-content.php'; //Featured Slider require get_template_directory() . '/inc/customizer-includes/featured-slider.php'; //News Ticker require get_template_directory() . '/inc/customizer-includes/news-ticker.php'; //Social Links require get_template_directory() . '/inc/customizer-includes/social-icons.php'; // Reset all settings to default $wp_customize->add_section( 'automobile_reset_all_settings', array( 'description' => __( 'Caution: Reset all settings to default. Refresh the page after save to view full effects.', 'automobile' ), 'priority' => 700, 'title' => __( 'Reset all settings', 'automobile' ), ) ); $wp_customize->add_setting( 'automobile_theme_options[reset_all_settings]', array( 'capability' => 'edit_theme_options', 'default' => $defaults['reset_all_settings'], 'sanitize_callback' => 'automobile_reset_all_settings', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'automobile_theme_options[reset_all_settings]', array( 'label' => __( 'Check to reset all settings to default', 'automobile' ), 'section' => 'automobile_reset_all_settings', 'settings' => 'automobile_theme_options[reset_all_settings]', 'type' => 'checkbox', ) ); // Reset all settings to default end //Important Links $wp_customize->add_section( 'important_links', array( 'priority' => 999, 'title' => __( 'Important Links', 'automobile' ), ) ); /** * Has dummy Sanitizaition function as it contains no value to be sanitized */ $wp_customize->add_setting( 'important_links', array( 'sanitize_callback' => 'automobile_sanitize_important_link', ) ); $wp_customize->add_control( new automobile_Important_Links( $wp_customize, 'important_links', array( 'label' => __( 'Important Links', 'automobile' ), 'section' => 'important_links', 'settings' => 'important_links', 'type' => 'important_links', ) ) ); //Important Links End } add_action( 'customize_register', 'automobile_customize_register' ); /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously for Automobile. * And flushes out all transient data on preview * * @since Automobile 0.1 */ function automobile_customize_preview() { wp_enqueue_script( 'automobile_customizer', get_template_directory_uri() . '/js/automobilecustomizer.min.js', array( 'customize-preview' ), '20120827', true ); //Flush transients automobile_flush_transients(); } add_action( 'customize_preview_init', 'automobile_customize_preview' ); /** * Custom scripts and styles on customize.php for Automobile. * * @since Automobile 0.1 */ function automobile_customize_scripts() { wp_enqueue_script( 'automobile_customizer_custom', get_template_directory_uri() . '/js/automobilecustomizer-custom-scripts.min.js', array( 'customize-controls', 'iris', 'underscore', 'wp-util' ), '20150630', true ); $automobile_misc_links = array( 'upgrade_link' => esc_url( 'https://catchthemes.com/themes/automobile-pro/' ), 'upgrade_text' => __( 'Upgrade To Pro »', 'automobile' ), 'WP_version' => get_bloginfo( 'version' ), 'old_version_message' => __( 'Some settings might be missing or disorganized in this version of WordPress. So we suggest you to upgrade to version 4.0 or better.', 'automobile' ) ); //Add Upgrade Button and old WordPress message via localized script wp_localize_script( 'automobile_customizer_custom', 'automobile_misc_links', $automobile_misc_links ); wp_enqueue_style( 'automobile_customizer_custom', get_template_directory_uri() . '/css/customizer.css'); } add_action( 'customize_controls_enqueue_scripts', 'automobile_customize_scripts'); //Active callbacks for customizer require get_template_directory() . '/inc/customizer-includes/active-callbacks.php'; //Sanitize functions for customizer require get_template_directory() . '/inc/customizer-includes/sanitize-functions.php';