get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title a', 'render_callback' => 'blog_corner_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'blog_corner_customize_partial_blogdescription', ) ); } // Homepage Settings - Enable Homepage Content. $wp_customize->add_setting( 'blog_corner_enable_frontpage_content', array( 'default' => false, 'sanitize_callback' => 'blog_corner_sanitize_checkbox', ) ); $wp_customize->add_control( 'blog_corner_enable_frontpage_content', array( 'label' => esc_html__( 'Enable Homepage Content', 'blog-corner' ), 'description' => esc_html__( 'Check to enable content on static homepage.', 'blog-corner' ), 'section' => 'static_front_page', 'type' => 'checkbox', 'active_callback' => 'blog_corner_is_static_homepage_enabled', ) ); // Upsell Section. $wp_customize->add_section( new Blog_Corner_Upsell_Section( $wp_customize, 'upsell_section', array( 'title' => __( 'Blog Corner Pro', 'blog-corner' ), 'button_text' => __( 'Buy Pro', 'blog-corner' ), 'url' => 'https://ascendoor.com/themes/blog-corner-pro/', 'background_color' => '#ff5d5d', 'text_color' => '#ffffff', 'priority' => 0, ) ) ); // Theme Options. require get_template_directory() . '/inc/customizer/theme-options.php'; // Front Page Options. require get_template_directory() . '/inc/customizer/front-page-options.php'; } add_action( 'customize_register', 'blog_corner_customize_register' ); /** * Render the site title for the selective refresh partial. * * @return void */ function blog_corner_customize_partial_blogname() { bloginfo( 'name' ); } /** * Render the site tagline for the selective refresh partial. * * @return void */ function blog_corner_customize_partial_blogdescription() { bloginfo( 'description' ); } /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function blog_corner_customize_preview_js() { // Append .min if SCRIPT_DEBUG is false. $min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; wp_enqueue_script( 'blog-corner-customizer', get_template_directory_uri() . '/assets/js/customizer' . $min . '.js', array( 'customize-preview' ), BLOG_CORNER_VERSION, true ); } add_action( 'customize_preview_init', 'blog_corner_customize_preview_js' ); /** * Enqueue script for custom customize control. */ function blog_corner_custom_control_scripts() { // Append .min if SCRIPT_DEBUG is false. $min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; wp_enqueue_style( 'blog-corner-custom-controls-css', get_template_directory_uri() . '/assets/css/custom-controls' . $min . '.css', array(), '1.0', 'all' ); wp_enqueue_style( 'blog-corner-fontawesome-controls-css', get_template_directory_uri() . '/assets/css/fontawesome' . $min . '.css', array(), '6.4.2' ); wp_enqueue_script( 'blog-corner-custom-controls-js', get_template_directory_uri() . '/assets/js/custom-controls' . $min . '.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-sortable' ), '1.0', true ); } add_action( 'customize_controls_enqueue_scripts', 'blog_corner_custom_control_scripts' );