Add support for theme customizer
This commit is contained in:
21
lib/customizer.php
Normal file
21
lib/customizer.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Roots\Sage\Customizer;
|
||||
|
||||
use Roots\Sage\Assets;
|
||||
|
||||
/**
|
||||
* Add postMessage support
|
||||
*/
|
||||
function customize_register($wp_customize) {
|
||||
$wp_customize->get_setting('blogname')->transport = 'postMessage';
|
||||
}
|
||||
add_action('customize_register', __NAMESPACE__ . '\\customize_register');
|
||||
|
||||
/**
|
||||
* Customizer JS
|
||||
*/
|
||||
function customize_preview_js() {
|
||||
wp_enqueue_script('sage/customizer', Assets\asset_path('scripts/customizer.js'), ['customize-preview'], null, true);
|
||||
}
|
||||
add_action('customize_preview_init', __NAMESPACE__ . '\\customize_preview_js');
|
||||
Reference in New Issue
Block a user