Remove Sidebar On Genesis Home, Page or Posts

The easiest way to remove a sidebar from your home page if using a Genesis child theme is to add this code to your child theme’s home.php file.

remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );

Make sure you add the PHP code before the genesis(); tag.

You could also add CSS code to your child themes style.css file to hide the sidebar from your home page:

.home #sidebar {
display: none;
}

Once you remove the sidebar from your home page, you may want to increase the content area to 100% width to fill the white space from where you’ve removed the sidebar.

.home #content {
width: 100%;
}

Change the percentage if you don’t want to display full width content.

Remove Sidebar on Pages and Posts

Simple change the layout settings to full width.

Full Width Page Layout Settings

Or you can find your post or page i.d in your source code and use it with CSS code in your child themes style.css file.

.postid-37900 #sidebar {
display: none;
}

Remove Sidebar From Archive Pages Using CSS

Removing the sidebar from archive pages like your blog or category archives is very similar to removing the sidebar from static pages.

Grab the category i.d or page template name from your body class in the source code and use it with CSS code in your child themes style.css file.

.page-template-page_blog-php #sidebar {
display: none;
}

Related Tutorials


Comments

10 responses to “Remove Sidebar On Genesis Home, Page or Posts”

  1. Michelle Avatar
    Michelle

    This helped me solve a problem I was having, although I had to alter the code. I wanted to use the widgetized homepage of the Foodie theme, while maintaining the sidebar as the “default” for the rest of the site (so it not only appears on the main blog page, but also category pages, etc).

    This PHP didn’t seem to work for me, but I just put in this CSS (classes instead of ids):
    [code]
    .home .sidebar-primary {
    display: none;
    }

    .home .content {
    width: 100%;
    }
    [/code]

    1. Brad Dalton Avatar
      Brad Dalton

      Hello MIchelle.

      Which PHP code didn’t work?

  2. Hi Brad, I am trying to remove the sidebar from a single page and when I try and change the layout setting it doesn’t change my default choice. I followed the link to theme settings and I cant change it there either. I’m using genesis eleven40

    any ideas. thanks

    1. Brad Dalton Avatar
      Brad Dalton

      Which page? It may be overwritten by some code or a plugin.

      Another option is to use code. http://wpsites.net/web-design/change-layout-based-on-any-conditions/

      1. Hi Brad, any page , even when I try and create it as new page or post for that matter. I can see the layout setting but it wont except any chose. when I click on it.

        Ill try deactivating a few of the genesis ones and see if it works. 🙂

        1. Brad Dalton Avatar
          Brad Dalton

          I would bulk deactivate all plugins and see if that works.

          Otherwise, you can use the code i linked to.

          1. Turns out the new genesis 2.1 update fixed the issue, I think it was an IE11 problem

          2. Brad Dalton Avatar
            Brad Dalton

            Glad you fixed it, its getting complicated with browser issues and Mobile responsiveness!

  3. Hey, thanks for this tutorial, I know that I may sound like a dweeb but how do I do this for the product page? For all product pages that is, thanks!

    1. Brad Dalton Avatar
      Brad Dalton

      Add the code in your child themes functions file.

      It sounds like you’re using WooCommerce who supply a huge range of hooks, filters and conditional tags.

      You can use either PHP or CSS code.

Leave a Reply

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.