diff --git a/src/admin.php b/src/admin.php index bb25aac..ba6979a 100644 --- a/src/admin.php +++ b/src/admin.php @@ -8,6 +8,12 @@ namespace App; add_action('customize_register', function (\WP_Customize_Manager $wp_customize) { // Add postMessage support $wp_customize->get_setting('blogname')->transport = 'postMessage'; + $wp_customize->selective_refresh->add_partial('blogname', [ + 'selector' => '.brand', + 'render_callback' => function () { + bloginfo('name'); + } + ]); }); /** diff --git a/src/setup.php b/src/setup.php index 63749ca..fcf4873 100644 --- a/src/setup.php +++ b/src/setup.php @@ -54,6 +54,12 @@ add_action('after_setup_theme', function () { */ add_theme_support('html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form']); + /** + * Enable selective refresh for widgets in customizer + * @link https://developer.wordpress.org/themes/advanced-topics/customizer-api/#theme-support-in-sidebars + */ + add_theme_support('customize-selective-refresh-widgets'); + /** * Use main stylesheet for visual editor * @see assets/styles/layouts/_tinymce.scss