get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; // Load customize option. require get_template_directory() . '/inc/customizer/option.php'; // Load slider customize option. require get_template_directory() . '/inc/customizer/slider.php'; // Load reset option. require get_template_directory() . '/inc/customizer/reset.php'; // Modify default customizer options. $wp_customize->get_control( 'background_color' )->description = __( 'Note: Background Color is applicable only if no image is set as Background Image.', 'bizroot' ); } add_action( 'customize_register', 'bizroot_customize_register' ); /** * Load styles for Customizer. * * @since 1.0.0 */ function bizroot_load_customizer_styles() { global $pagenow; if ( 'customize.php' === $pagenow ) { $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; wp_enqueue_style( 'bizroot-customizer-style', get_template_directory_uri() . '/css/customizer' . $min . '.css', false, '1.0.0' ); } } add_action( 'admin_enqueue_scripts', 'bizroot_load_customizer_styles' ); /** * Add Upgrade To Pro button. * * @since 1.1.0 */ function bizroot_custom_customize_enqueue_scripts() { $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; wp_register_script( 'bizroot-customizer-button', get_template_directory_uri() . '/js/customizer-button' . $min . '.js', array( 'customize-controls' ), '1.1.0', true ); $data = array( 'updrade_button_text' => __( 'Buy Bizroot Pro', 'bizroot' ), 'updrade_button_link' => esc_url( 'http://themepalace.com/downloads/bizroot-pro/' ), ); wp_localize_script( 'bizroot-customizer-button', 'Bizroot_Customizer_Object', $data ); wp_enqueue_script( 'bizroot-customizer-button' ); } add_action( 'customize_controls_enqueue_scripts', 'bizroot_custom_customize_enqueue_scripts' ); /** * Customizer partials. * * @since 1.0.0 */ function bizroot_customizer_partials( WP_Customize_Manager $wp_customize ) { // Abort if selective refresh is not available. if ( ! isset( $wp_customize->selective_refresh ) ) { $wp_customize->get_setting( 'blogname' )->transport = 'refresh'; $wp_customize->get_setting( 'blogdescription' )->transport = 'refresh'; $wp_customize->get_setting( 'theme_options[footer_contact_email]' )->transport = 'refresh'; $wp_customize->get_setting( 'theme_options[footer_contact_phone]' )->transport = 'refresh'; $wp_customize->get_setting( 'theme_options[footer_contact_address]' )->transport = 'refresh'; $wp_customize->get_setting( 'theme_options[copyright_text]' )->transport = 'refresh'; return; } // Load customizer partials callback. require get_template_directory() . '/inc/customizer/partials.php'; // Partial blogname. $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title a', 'container_inclusive' => false, 'render_callback' => 'bizroot_customize_partial_blogname', ) ); // Partial blogdescription. $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'container_inclusive' => false, 'render_callback' => 'bizroot_customize_partial_blogdescription', ) ); // Partial footer_contact_email. $wp_customize->selective_refresh->add_partial( 'footer_contact_email', array( 'selector' => '#footer-contact-section .quick-email', 'container_inclusive' => false, 'settings' => array( 'theme_options[footer_contact_email]' ), 'render_callback' => 'bizroot_render_partial_footer_contact_email', ) ); // Partial footer_contact_phone. $wp_customize->selective_refresh->add_partial( 'footer_contact_phone', array( 'selector' => '#footer-contact-section .quick-call', 'container_inclusive' => false, 'settings' => array( 'theme_options[footer_contact_phone]' ), 'render_callback' => 'bizroot_render_partial_footer_contact_phone', ) ); // Partial footer_contact_address. $wp_customize->selective_refresh->add_partial( 'footer_contact_address', array( 'selector' => '#footer-contact-section .quick-address', 'container_inclusive' => false, 'settings' => array( 'theme_options[footer_contact_address]' ), 'render_callback' => 'bizroot_render_partial_footer_contact_address', ) ); // Partial copyright_text. $wp_customize->selective_refresh->add_partial( 'copyright_text', array( 'selector' => '#colophon .copyright', 'container_inclusive' => false, 'settings' => array( 'theme_options[copyright_text]' ), 'render_callback' => 'bizroot_render_partial_copyright_text', ) ); } add_action( 'customize_register', 'bizroot_customizer_partials', 99 );