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.
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;
}
Michelle says
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):
Brad Dalton says
Hello MIchelle.
Which PHP code didn’t work?
Greg says
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
Brad Dalton says
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/
Greg says
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. 🙂
Brad Dalton says
I would bulk deactivate all plugins and see if that works.
Otherwise, you can use the code i linked to.
Greg says
Turns out the new genesis 2.1 update fixed the issue, I think it was an IE11 problem
Brad Dalton says
Glad you fixed it, its getting complicated with browser issues and Mobile responsiveness!
Steve says
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!
Brad Dalton says
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.