Functions: Check if page has sidebar

To check if the current page has the sidebar enabled, use the md_has_sidebar() conditional tag.

Use this tag to check if the Main Sidebar (or custom sidebar) is enabled on the page. Detects settings from the MD Layout panel to make this function more precise based on the page’s settings.

Example usage:

How to enqueue a script on pages only with the sidebar enabled.

function my_enqueue_function() {

	if ( md_has_sidebar() ) {
		wp_enqueue_script( 'my-script', '', array( '' ), '', true );


add_action( 'wp_enqueue_scripts', 'my_enqueue_function' );

Leave a Comment