Last updated on

BoldGrid themes installed through the Inspirations plugin display the sidebar by default for all blog post and archive pages, but sometimes you do not want it to show.  This guide will demonstrate how you can use filters to hook into the theme configuration and make the customizations you need.

The best way to add filters to your website’s theme is to use a plugin, such as Code Snippets, which will allow you to make the necessary changes without modifying your theme files directly.  This biggest reason to use this method is that it allows your custom code to persist through theme updates.

Once you have your preferred code manager installed you can create a new entry with the following snippet:

function hide_sidebar ($config) {
    $config['template']['sidebar'] = [
        'is_archive',
        'is_blog',
        'is_single',
        '[page_home.php]is_page_template',
        '[default]is_page_template',
    ];
    return $config;
}

add_filter( 'boldgrid_theme_framework_config' , 'hide_sidebar' );

The sidebar will display automatically on every page, except for those included in the [‘template’][‘sidebar’] array within the theme configuration, and the provided snippet adds your blog pages to that array.

 

SIGNUP FOR

BOLDGRID CENTRAL  

   200+ Design Templates + 1 Kick-ass SuperTheme
   6 WordPress Plugins + 2 Essential Services

Everything you need to build and manage WordPress websites in one Central place.

4 thoughts on “How to Disable the Blog Sidebar in GridOne

  1. Entering this code into Code Snippets removed the sidebar from the single-post pages, but not from the main blog page. It ALSO removed the menus at the top of the page, which I haven’t been able to resolve.

    • Hi Matt-
      Thanks for the comment. I’ve updated the code to include is_blog to eliminate the sidebar from the main blog page. However, in my tests this code doesn’t remove the menu. Can you start a new forum post so you can include your site’s URL and we can take a look for you?

Leave a Reply

Your email address will not be published.