Fix some js errors, see diff

set sophia_after_dark_enable_top_header always to false, as it would a a bar to the top of the page below the admin bar
also did some general fixing on php :)
This commit is contained in:
2025-05-11 17:51:48 -07:00
parent 5fd30040a4
commit aafbabb209
10 changed files with 345 additions and 378 deletions

View File

@ -6,37 +6,36 @@
* Contains handlers to make Theme Customizer preview reload changes asynchronously.
*/
( function( $ ) {
(($) => {
const setText = (selector, text) => $(selector).text(text);
// Site title and description.
wp.customize( 'blogname', function( value ) {
value.bind( function( to ) {
$( '.site-title a' ).text( to );
} );
} );
wp.customize( 'blogdescription', function( value ) {
value.bind( function( to ) {
$( '.site-description' ).text( to );
} );
} );
const setVisibility = (isVisible, color) => {
const titleDesc = $('.site-title, .site-description');
const titleLink = $('.site-title a, .site-description');
// Header text color.
wp.customize( 'header_textcolor', function( value ) {
value.bind( function( to ) {
if ( 'blank' === to ) {
$( '.site-title, .site-description' ).css( {
'clip': 'rect(1px, 1px, 1px, 1px)',
'position': 'absolute'
} );
} else {
$( '.site-title, .site-description' ).css( {
'clip': 'auto',
'position': 'relative'
} );
$( '.site-title a, .site-description' ).css( {
'color': to
} );
}
} );
} );
} )( jQuery );
if (!isVisible) {
titleDesc.css({
clip: 'rect(1px, 1px, 1px, 1px)',
position: 'absolute'
});
} else {
titleDesc.css({
clip: 'auto',
position: 'relative'
});
titleLink.css('color', color);
}
};
wp.customize('blogname', (value) => {
value.bind((to) => setText('.site-title a', to));
});
wp.customize('blogdescription', (value) => {
value.bind((to) => setText('.site-description', to));
});
wp.customize('header_textcolor', (value) => {
value.bind((to) => setVisibility(to !== 'blank', to));
});
})(jQuery);