customizer.js
1023 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* File: customizer.js.
*
* Theme Customizer enhancements for a better user experience.
*
* Contains handlers to make Theme Customizer preview reload changes asynchronously.
*/
( function () {
let anchor = document.querySelector( '.navbar-brand' );
if ( 'H1' === anchor.tagName ) {
anchor = anchor.firstChild;
}
// Site title.
wp.customize( 'blogname', function ( value ) {
value.bind( function ( to ) {
anchor.textContent = to;
} );
} );
// Header text color.
wp.customize( 'header_textcolor', function ( value ) {
value.bind( function ( to ) {
if ( 'blank' === to ) {
anchor.style.clip = 'rect(1px, 1px, 1px, 1px)';
anchor.style.position = 'absolute';
} else {
anchor.style.clip = 'auto';
anchor.style.position = 'relative';
anchor.style.color = to;
}
} );
} );
// Site info.
wp.customize( 'understrap_site_info_override', function ( value ) {
value.bind( function ( to ) {
document.querySelector( '.site-info' ).innerHTML = to;
} );
} );
} )();