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' => 'bring_back_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'bring_back_customize_partial_blogdescription', ) ); } } add_action( 'customize_register', 'bring_back_customize_register' ); /** * Adding Go to Pro Section in Customizer * https://github.com/justintadlock/trt-customizer-pro */ if( class_exists( 'WP_Customize_Section' ) ) : class Bring_Back_Kirki_Customize_Section_Pro extends WP_Customize_Section { /** * The type of customize section being rendered. * * @since 1.0.0 * @access public * @var string */ public $type = 'pro-section'; /** * Custom button text to output. * * @since 1.0.0 * @access public * @var string */ public $pro_text = ''; /** * Custom pro button URL. * * @since 1.0.0 * @access public * @var string */ public $pro_url = ''; /** * Add custom parameters to pass to the JS via JSON. * * @since 1.0.0 * @access public * @return void */ public function json() { $json = parent::json(); $json['pro_text'] = $this->pro_text; $json['pro_url'] = esc_url( $this->pro_url ); return $json; } /** * Outputs the Underscore.js template. * * @since 1.0.0 * @access public * @return void */ protected function render_template() { ?>
  • {{ data.title }} <# if ( data.pro_text && data.pro_url ) { #> {{ data.pro_text }} <# } #>

  • register_section_type( 'Bring_Back_Kirki_Customize_Section_Pro' ); // Register sections. $wp_customize->add_section( new Bring_Back_Kirki_Customize_Section_Pro( $wp_customize, 'bring_back_get_pro', array( 'title' => esc_html__( 'Pro Available', 'bring-back' ), 'priority' => 5, 'pro_text' => esc_html__( 'Get Pro Theme', 'bring-back' ), 'pro_url' => 'https://www.themetim.com/wordpress-themes/bring-back/' ) ) ); } /** * Early exit if Kirki exists. */ $user_id = get_current_user_id(); if ( !get_user_meta( $user_id, 'bring_back_kirki_plugin_dismissed' ) ){ require get_template_directory() . '/inc/kirki/include-kirki.php'; } require get_template_directory() . '/inc/kirki/bring-back-kirki.php'; /** * Kirki Customizer settings */ Bring_Back_Kirki::add_config( 'bring_back', array( 'capability' => 'edit_theme_options', 'option_type' => 'theme_mod', ) ); require get_template_directory() . '/inc/kirki/kirki-customizer.php'; /** * Render the site title for the selective refresh partial. * * @return void */ function bring_back_customize_partial_blogname() { bloginfo( 'name' ); } /** * Render the site tagline for the selective refresh partial. * * @return void */ function bring_back_customize_partial_blogdescription() { bloginfo( 'description' ); } /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function bring_back_customize_preview_js() { wp_enqueue_script( 'bring-back-customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20151215', true ); } add_action( 'customize_preview_init', 'bring_back_customize_preview_js' );