Check if page has a sidebar

A simple filter to make smart decisions.


Example: Enqueue a script only if the page has a sidebar.

Click to copy
function my_enqueue_function() {
	if ( md_has_sidebar() )
		wp_enqueue_script( 'my-script', '', array( '' ), '', true );
add_action( 'wp_enqueue_scripts', 'my_enqueue_function' );
Click to copy
Click to copy
Click to copy

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.

Start Building Websites That Delight

You can use the Marketers Delight WordPress Theme on unlimited sites. New features & updates are delivered to sites with your active license key.

Add to Cart