Hide sidebars from Business Directory Listings

Hide sidebars from Business Directory Listings

Depending on the look you are creating for your membership site, you may or may not want to display your site’s sidebars on each individual Business Directory listing.

In this tutorial will demonstrate how to use the free version of a very powerful WordPress plugin called ‘Content Aware Sidebars‘ to hide the content from the sidebars on your Business Directory listing pages without changing any code or creating new templates.

Does my theme support hidden sidebars?

Your theme determines how sidebars are handled and displayed. Most modern themes are setup to check whether a sidebar is active (aka, is being used / contains content). The theme will then either display the sidebar if it has content or use a full-width layout if the sidebar is empty. Both the Chamber Beautiful and Chamber Inspired themes are coded this way.

Pro Tip: In some older themes the sidebar can be hidden, but a blank space will take its place.

If you follow this tutorial and find out that your theme leaves space for the sidebar even though it has been hidden, you may need to update your theme’s code or it may be time to update to a newer theme to one that supports completely hiding a sidebar.

Using the ‘Content Aware Sidebars’ plugin

The Content Aware Sidebars plugin makes it possible to remove sidebars from any page or post without using any code and is great for showing and hiding sidebars on all different types of content. Here we will show you how to use it to hide the sidebars from your Business Directory Listings.

Download Content Aware Sidebars plugin from the WordPress Repo.

How WordPress themes work

In addition to coding the theme to automatically use a full-width layout if no active sidebar content is found as discussed above, some themes include a full-width page template that can be used to remove the sidebar from pages manually. In order to use this feature, you would need to edit every single page that you wanted to make full-width.

No big deal if you are only using it on one or two pages, but if you want to change all of your pages or posts, this could get overwhelming. Also note that a page template won’t work for posts and it is much less likely that the theme includes a full width template for blog posts or custom post types.

Remove Sidebar from WordPress Pages

Using the Content Aware Sidebars plugin it’s super easy to hide the sidebar from individual pages, or even from all pages at once!

Once you have the plugin installed and activated:

  • Go to Content Aware >> Add New
  • On the ‘Conditions’ tab, use the ‘new condition group’ drop-down to select Pages
  • Click on ‘all fields’ to select just a few pages to remove the sidebar from. Or leave it empty for all pages.
Hide-sidebars-from-Business-Directory-Listings-all-theme-pages
  • Go to the ‘Action’ tab. Check to be sure Action = Replace and Target Sidebar = your site’s primary sidebar.
  • Give the new sidebar a title, set status to active and click Create.
Hide-sidebars-from-Business-Directory-Listings-action-is-replace

Pro Tip: When naming your sidebar, ‘Hidden Sidebar’ works well because the new sidebar is going to show up in your Widgets area, and this title will remind you not to add any content there.

Remove sidebars from Business Directory Listings

You can use almost the same process as above to hide sidebars from posts.

However, Chamber Dashboard Business Directory listings are custom post types. A custom post type is not included with the regular WordPress posts. So, in order to remove sidebars from custom post type:

  • Go to Content Aware >> Add New
  • On the ‘Conditions’ tab, use the ‘new condition group’ drop-down to select Businesses
  • Leave the ‘all businesses’ field empty to remove the sidebar from all Business listings.
Hide-sidebars-from-Business-Directory-Listings-choose-custom-post-type
  • On the ‘Action’ tab. Check to be sure Action = Replace and Target Sidebar = your site’s primary sidebar.
  • Give the new sidebar a title, set status to active and click Create.
Hide-sidebars-from-Business-Directory-Listings-activate

Depending on how your theme was built, your individual Directory listings should have updated from displaying WITH a sidebar…

Business-Directory-listing-with-sidebar

To displaying withOUT a sidebar. AKA using a full-width display layout.

Business-Directory-listing-hidden-sidebar

Getting Support

Please note that Content Aware Sidebars is a 3rd party plugin. If you are having trouble hiding a sidebar, please visit their support forum on WordPress.org to open a support thread.

If you have questions about Chamber Dashboard themes & plugins, please visit our support page here.