Skip to content

Commit 8f2c964

Browse files
committed
dynamic sidebar updates should check for primary sidebar being active - fixes #118
1 parent c01a203 commit 8f2c964

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/assets/js/customizer/widget/section-update.js

+5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ export default function() {
1111
sections = _.filter( window._wpCustomizeSettings.sections, ( section, id ) => id.includes( 'sidebar-widgets' ) );
1212

1313
sections.map( section => api.section( section.id ).active.set( activeSections.includes( section.id ) ) );
14+
15+
// Check for primary sidebar activation/deactivation.
16+
let body = $( wp.customize.previewer.container ).find( 'iframe' ).last().contents().find( 'body' )[0];
17+
api.section( 'sidebar-widgets-primary-sidebar' ).active.set( body.classList.contains( 'has-sidebar' ) );
1418
};
19+
1520
api.previewer.bind( 'ready', () => update() );
1621
api.previewer.bind( 'bgtfw-widget-section-update', () => update() );
1722
} );

0 commit comments

Comments
 (0)