Removing Genesis Sidebars

Some days when working on websites, I feel like I’m losing my mind. Not just the times when a client has scads of amateurish photos and wants to have 20 slideshows, or when an engineer is unwaveringly insistent on using repulsive design ideas. Sometimes I’ll just try something that I’ve done many times before, and it suddenly stops working.

She's just about ready to explode!
She’s just about ready to explode! Sometimes I look like her in spirit!

If you use Genesis, you may find that sometimes you want to remove the sidebar from a page in some contexts. I have a designer colleague who absolutely loves to have a different sidebar on every page. While this can be effective at times, I find that this “more is more”approach is often pretty cluttered, and can even make a site harder to navigate and rather watered-down. Advisable or not, there are ways to do that. Genesis Simple Sidebars plugin is one way. You can easily go sidebar-berserk with that and make as many sidebars as you want without coding! But even with that, in some contexts you may want to remove the default sidebar, like on the homepage, for instance.

How to Remove Either Genesis Sidebar

If you’re a Genesis hacker, you’ll be very familiar with this. You just use either of these lines in your functions.php:

remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
remove_action( 'genesis_sidebar_alt', 'genesis_do_sidebar_alt' );

And now with just a bit more context, I might do this to make it happen only on the homepage:

add_action( 'genesis_before_loop', 'dc_yank_em_out' );
function dc_yank_em_out() {
   if ( is_home() ) {
      remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
      remove_action( 'genesis_sidebar_alt', 'genesis_do_sidebar_alt' );
   }
}

Simply Read, and Not Removed

So one day, I tried the above method, and nothing happened! I noticed that having the Genesis Simple Sidebars plugin seemed to interfere. I assumed that the plugin just “took over”. But then I hunted down the answer – variations!

remove_action( 'genesis_sidebar', 'ss_do_sidebar' );
remove_action( 'genesis_sidebar_alt', 'ss_do_sidebar_alt' );

Woo Hoo!

So several projects later, I was using Simple Sidebars with the same designer, and I thought I’d be all smart and use the variations. They didn’t work! But I persisted and found the answer again… Woo Commerce was installed, and the Genesis Connect For Woo is nearly mandatory for using that with the Genesis/Woo combo, otherwise sidebar weirdness may ensue. When Genesis Connect is in play, just use these:

remove_action( 'genesis_sidebar', 'gencwooc_ss_do_sidebar' );
remove_action( 'genesis_sidebar_alt', 'gencwooc_ss_do_sidebar_alt' );

UPDATE as of 1/15: It now seems as though my Woo fix just above no longer works! I ran into this wall while making changes to Woo Sensei. I did a bunch of testing, and no joy, whether using Sensei or WooCommerce alone. Craig’s variation in the comments below didn’t work for me, either. There have been some significant updates to WooCommerce, so those may have blown this idea up. Searching through the Woo site, all I could find was a support tech advising someone to vanish the sidebar with CSS in such cases. Certainly easy to do, but a bit cheesy IMO. I also found that if Genesis Connect For WooCommerce is active, the Simple Sidebars example hook above no longer works, either. So somewhere in the mix of Genesis Connect and WooCommerce something is busticated. 🙂

It is possible that there are other Genesis plugins which also may mess with the original command. If you find one, why not let us know here? Or if you suspect one but aren’t sure, let me know and I will look into it if I have time. 🙂

Shameless quick plug: if you’re looking for an attractive food-oriented theme, please have a look at Foodie. (yes, I am an affiliate)

32 Comments


  1. Thanks! I was struggling with the same. Deactivating Simple Sidebars did the thing.

    Reply

    1. Corine,
      I’m glad that was helpful!
      Dave

      Reply

  2. Hello, I am building a woocommerce site on genesis, I am using Genesis Connect for Woocommerce, and Genesis Simple Sidebar. I have a specific sidebar for my shop page, i am trying to remove the #sidebar and put it back before #content, because i want the sidebar above the content when on mobile. I have been fighting and fighting, I finally found this “remove_action( ‘genesis_sidebar’, ‘gencwooc_ss_do_sidebar’ );” that you have here, but it is still not working!!! I have the template copied over to my child theme, but i cannot get this, please help!

    Reply

    1. Hi Rob,
      It’s always possible that plugins will change, causing things not to work. So I re-installed current versions of that stuff and tested. But my code still works great.

      I can’t see your site or your code. With that little info, I can still make a guess. You mention copying a template, so if you put my code in there, it may not work in that context for some reason. Also, a special page template can simply ignore any functions.php commands and do its own thing! That’s all I can offer with no “boots on the ground”.

      I have one other idea besides hiring me to fix it. 😉 Try my fancy CSS hack for moving the sidebar above the content. If you only want it for that one page, you’ll need to make the CSS more specific than my example.

      Cheers, Dave

      Reply

  3. Thanks for the fast reply Dave! I posted a link to my stage site, if it is public, can you remove that then for me please?

    I have the archive-product.php template file, from the Gen C Woo plugin copied over to my themes woocommerce directory. i am putting your code there. is there somewhere else i should be putting it? Since I couldn’t get this, I just decided to do it with some jQuery using prependTo(); to pull the #content div and move it to the end of #content-sidebar-wrap. But after reading you CSS solution, I will be converting to using that!! Nice job with that, keeping the div structure the way we would want it for SEO, thats great!

    I want to move the sidebar on my “shop” page so that you do not have to scroll though a huge list of products to get to the product filters, since that is all that I am using the sidebar for on that page I felt that it was more convenient.. I do however still wish to figure out the gencwoo hooks mixed with the simple sidebar and all. Thanks again, I will be looking through your blog for more tips since you seem to have a pretty good handle on this!

    Reply

    1. Hey Rob,
      Shop’s looking good so far! You obviously know a lot of WP, sounds like you’re just doing the Genesis learning curve a bit. If you’re using a raw Woo template, it may not hook into Genesis properly to have my code work. I actually mention where to put my code above; to clarify, unless I say otherwise, almost any code sample I give for Genesis is run in your child theme’s functions.php. That’s a matter of personal taste – my child themes generally just have that file, and maybe 2 or 3 others – very lean and mean, and I do everything with hooks and filters. That’s really where Genesis begins to sing, and it does take awhile to know them. Genesis Visual Hook Guide is super-handy as a guide!

      Others like to use actual template files, and maybe that’s your preference. I can’t see your code, but off the top of my head, you could try genesis(); as the final command in your template file and see if that makes my code work from there. I’m flying blind here, it could blow up. 😉

      jQuery… nice! The reason I have so many tricks is that I get asked to do pretty off-the-wall things (stuff I’d never do on my sites!). In many of those cases, I, too, have used jQuery to fill in the blanks that plugins or PHP aren’t quite doing. Being a CSS freak, I tend to go there first. For instance, Sridhar, a Genesis ace, did a jQuery hack to equalize column heights, whereas I used an easier CSS hack known as the One True Layout method. Different strokes!

      Good on ya, Dave

      Reply

  4. Spot on – needed this to deal with the conflict from the Genesis Connect WooCommerce plugin. Thank you.

    Reply

  5. Paul,
    You’re welcome. Glad to hear that!

    On a somewhat related topic, I’m starting to get Woo Sensei fix requests again. Something must be in the air!

    Dave

    Reply

  6. Funny, had same issue.
    Was using Easy digital downloads with genesis and simple sidebars.
    Took forever to find the hack to make the sidebars go away.
    Then switched over to woo and had problem all over again.

    The code you suggest still isn’t working for me though. I do know that genesis connect pushed an update in the last few days though.

    Back to drawing board.

    Reply

  7. Hi Craig,
    Good question! I just did a test. I had Woo Commerce activated (2.1.12), Genesis Connect for Woo (0.9.8), and Genesis Simple Sidebars (1.7.1). My special code above did work in that scenario!

    Then I turned off Genesis Simple Sidebars, and then the regular remove sidebar code worked. (the very first example above).

    I do have one more suggestion. In some contexts add_action or remove_action may require a priority, depending on context. My setup didn’t require it, but I also got the sidebar to remove using a priority of 10.

    Cheers, Dave

    Reply

  8. Wow, fast response. Found the fix. Have to edit the priority of the action hook. here’s my fix:

    In response to flamenco’s post. I was able to get it working with this code. I had to change the priority and location of the action hook.

    add_action('get_header','os_change_genesis_sidebar', 11); //11 used as priority to match woo connect genesis integration
    function os_change_genesis_sidebar() {
    remove_action( 'genesis_sidebar', 'gencwooc_ss_do_sidebar' ); //special remove hook for when genesis simple sidebars & Genesis Woo Connect plugin is active
    }

    You’ll see the woo connect genesis plugin file for genesis-simple-sidebars.php in the sp-plugins-integration folder. First few lines deals with the integration/

    Reply

      1. I’m glad that worked for you, Mike. This gets trickier and trickier over time. Genesis plugins may go stale over time – their developers are busy with other things. As for the Genesis mothership, it’s gone very quiet since Genesis 2 has stabilized. Many of those people seem to have moved on to other things now. So I’m afraid that experimentation will be needed for doing this these days.

        Reply

  9. Craig,
    I edited my comment above, and now it seems we’ve reached the destination using similar but different methods.

    Good show!

    Dave

    Reply

  10. Thanks great info. Question how would I add a sidebar left to just one page. That way I can use a custom menu widget for sub pages.
    Thanks
    Matthew

    Reply

  11. Matthew,
    You could probably use Genesis Simple Sidebars for that. I also use the Custom Sidebars plugin, which is very nice.

    Reply

  12. I use Dynamik Web Site Builder for Genesis. This product had a way to add it to the one page. First thing solved. Second thing I need solved now is to add a custom side bar area called about to the widget page via code. Maybe adding the widget via code on just that page might be better. Please give me your thoughts. Thanks for the help.

    Reply

  13. Hey, thank you so much for writing this! I’ve spent the last hour trying to figure out why the standard sidebar unhook wasn’t working. It was because of Genesis Simple Sidebars.


    remove_action( 'genesis_sidebar', 'ss_do_sidebar' );

    Problem solved! I’ll try to keep that WooCommerce tip in mind too.

    Reply

    1. Jessea,
      Very cool, glad it helped!
      Dave

      Reply

  14. I’m totally new to coding, and trying to create a food blog website design. If I decided to use a child theme that doesn’t have sidebars, then how will I add sidebars? Is there anyway to do that?
    The child theme is: http://demo.clvnk.co/minny/.
    Thanks so much!!!

    Reply

    1. Hi Megs,
      Interesting question. That’s one of Calvin’s nice themes. I just quickie installed it and looked around. It’s clearly intended to be minimal with just the full page layout. Is there a way to add sidebars? Yes, but it takes some programming, so if you’re new, it could be quite tough. I’m going to assume that you have already bought Genesis if you’re looking at Genesis themes. I often see people buy a particular theme and then want to completely revamp it – this is definitely doing it the hard way, and I’ve touched on that general idea in this post.

      There are a couple nice food-related Genesis themes on Studiopress – Daily Dish has a similar clean look to Minny, and has loads of layouts. Foodie Pro is fancier and costs somewhat more – again, many layouts.

      There are certainly many nice completely free WordPress themes with various layouts, such as the ones in my article.

      Good luck,
      Dave

      Reply

  15. Thank you.

    remove_action( ‘genesis_sidebar’, ‘ss_do_sidebar’ );

    saved the day for me!

    Reply

    1. Saad,
      Sounds good! I’m glad the simple way worked.

      Now that Genesis is HTML5, the hooks are much more complex, so one may have to play with priorities to get that to work, just as Craig did above.

      Even priorities won’t solve every situation. More and more, I work on themes where the location of your code in functions.php (or elsewhere) is critical. A good example is any theme that has a large “theme setup” section, most often seen in 3rd party Genesis themes. In those, sometimes putting your code just at the end of that part is the magic key.

      And the fact is, you never quite know what Woo is going to do. They like to make huge changes every so often. You can tell when by the stress level of their users!

      Dave

      Reply

  16. you are my favorite internet person today. thank you for this:

    remove_action( ‘genesis_sidebar’, ‘gencwooc_ss_do_sidebar’ );
    remove_action( ‘genesis_sidebar_alt’, ‘gencwooc_ss_do_sidebar_alt’ );

    you have an update under the code snippet that says in no longer works but i’m happy to tell you well … it works again.

    Reply

    1. Ali, That’s cool, glad to hear it!

      These plugins can be a moving target, and some themes need extra code to make this type of change work.

      Dave

      Reply

  17. I had the same exploding face….!
    Thanks for the simple solution when using Simple Sidebars.

    Reply

    1. Sacha, Glad to hear it! Explosion reduction is good!

      Dave

      Reply

  18. Dave, try this.

    add_action( ‘get_header’, ‘bm_remove_sidebar’, 12 );
    function bm_remove_sidebar() {
    remove_action( ‘genesis_sidebar’, ‘genesis_do_sidebar’);
    remove_action( ‘genesis_sidebar’, ‘ss_do_sidebar’ );
    remove_action( ‘genesis_sidebar’, ‘gencwooc_ss_do_sidebar’ );
    }

    Genesis Connect for WooCommerce has a hook added to ‘get_header’ with priority ’11’, like this add_action( ‘get_header’, ‘gencwooc_ss_handler’, 11 );

    So, anything you hook to get_header with priority 12 or above should override that.

    Reply

    1. Bharat, Thanks! That looks like a great idea. I will try it if this comes up again.

      I haven’t used any Genesis plugins in a long time, although I still use Genesis frequently as a theme base. For sidebar trickery I’ve been using Custom Sidebars by WPMU, which offers very nice features.

      Dave

      Reply

    1. James, I’m glad to hear it!

      To be honest, I haven’t kept totally current on what plugins will override the Genesis hook there, because I haven’t needed to do this in awhile. 🙂

      Cheers, Dave

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *