How to remove the sidebar from a certain page?

After installing a Gallery Plugin or a Forum Plugin you might want to remove the sidebar (Primary Aside and Secondary Aside) to gain more space for the plugin’s output.

In my example for this task, I’m going to remove the sidebar from my page ‘Forum’.

The major requirement for this and all other code snippets: You have to use a child theme!

We start with the child theme’s functions.php and add the following code:

// filter thematic_sidebar() .. no display for the page 'Forum', keep it for the rest
function remove_sidebar() {
 // We test if we are on the page 'Forum'
 if (is_page('forum')) {
 // Yes, we are .. now we switch off the sidebar
 return FALSE;
 } else {
 // we are not .. we leave the switch on
 return TRUE;
// Connect the filter to thematic_sidebar()
add_filter('thematic_sidebar', 'remove_sidebar');

Now that we’re able to switch off the sidebar for the page ‘Forum’, we need to make the gained space available for our content.

We open the child theme’s style.css and add the following code:

body.slug-forum #container {
 width: 960px;

body.slug-forum #content {
 width: 940px;

Please note that this modification is related to the 2c-r-fixed layout. You might want to change the width settings according to your own design.

You can modify the conditions in remove_sidebar() to your needs … more details about <a title=”WordPress – Conditional Tags” href=”” target=”_self”>Conditional Tags</a>.

Tested with<a title=”Thematic, A WordPress Theme Framework” href=””> Thematic 0.9</a> and a basic child theme.

Please use the <a title=”ThemeShaper Forums” href=””>ThemeShaper Forums</a> for any further questions.

This entry was posted in Widget Area and tagged , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.


  1. Pam
    Posted February 10, 2010 at 11:34 am | Permalink

    Is there any way to get this to work on the home/index page?

    • Posted February 16, 2010 at 11:03 pm | Permalink

      Yes, change the (is_page('forum')) to (is_home()).

      • ba:D
        Posted March 3, 2010 at 7:59 pm | Permalink

        i’m using thematic and commune child theme.
        Thanks to this post on my homepage sidebars are actually off :)
        i added in style.css of the child theme :

        body.slug-Home #container {
        width: 960px;

        body.slug-Home #content {
        width: 940px;

        but content and container keep displaying at width:620px.

        what’s wrong?

        Thank you for your amazing work

        • Posted March 3, 2010 at 8:26 pm | Permalink

          CSS is case-sensitive. Change body.slug-Home to body.slug-home


      • Phil
        Posted May 24, 2010 at 11:41 am | Permalink

        Note that is_home() is picky when it comes to static pages. See to see when is_home() returns TRUE.

        For a static home page, is_front_page() might be a better choice.

  2. jo
    Posted March 14, 2010 at 12:15 am | Permalink

    This is great, however, is there a way to do the opposite? Remove the sidebar from all but one page.

    • Posted March 14, 2010 at 2:30 pm | Permalink

      This would be something like:

      function remove_sidebar() {
      if (!is_page('whatever')) {
      return FALSE;
      } else {
      return TRUE;
      add_filter('thematic_sidebar', 'remove_sidebar');

  3. Sarah Reiwitch
    Posted April 7, 2010 at 1:30 am | Permalink


    I was able to get rid of my sidebar on the homepage, but can’t seem to make the home page container and content pick up the style from the following that I put in my child style.css:

    body.slug-home #container {
    width: 960px;

    body.slug-home #content {
    width: 940px;

    When I inspect both the container and content divs on the home page using firebug it shows the container as:

    #container {
    from 2c-r-fixed.css (line 30)

    and the content from my child style.css:

    #content {
    margin:0 0 0 40px;

    The only way that I can get the width of the content to be wider is by modifying #content and #container, but that widens all the other pages as well, not just the home page content.

    Do you have any idea as to what might be wrong?

    Thanks so much for your terrific work.

    Thanks in advance for any help you can provide.

    • Posted April 7, 2010 at 2:33 pm | Permalink

      Hi Sarah,

      in this case you need to use:

      body.home #container {
      width: 960px;

      body.home #content {
      width: 940px;


      • Sarah Reiwitch
        Posted April 7, 2010 at 7:43 pm | Permalink

        Thanks so much for replying so promptly and providing me with the answer! That did the trick.

        I really appreciate it!

  4. Posted April 8, 2010 at 11:45 pm | Permalink

    How would one go about removing the sidebar for say two pages?

    I have tried:

    function remove_sidebar() {
    if (!is_page(’1′)(’2′)) {
    return FALSE;
    } else {
    return TRUE;
    add_filter(‘thematic_sidebar’, ‘remove_sidebar’);

    but it has failed. Thanks in advance for any help.

    • Posted April 11, 2010 at 3:42 pm | Permalink

      if (!is_page(array('1', '2'))) {

  5. Posted April 16, 2010 at 6:35 pm | Permalink

    Thanks for this forum! I had another variation for the question – What if I want to get rid off “only” the primary aside on the home page?

    • Bas
      Posted September 21, 2011 at 10:20 am | Permalink

      I’ve got the same issue as Shipra: how can I just remove one sidebar (secondary aside) from a certain page?

  6. Shipra
    Posted April 17, 2010 at 2:37 am | Permalink
  7. dave
    Posted April 18, 2010 at 9:08 pm | Permalink

    brill code, thanks Chris. the last bit was exactly what i was after.

  8. Posted May 2, 2010 at 11:20 am | Permalink

    you are a genius. thank you so much!

  9. Posted June 5, 2010 at 1:03 pm | Permalink

    Thank you for the straight forward answers and code. I needed to do exactly this (remove sidebars on one page) and it worked perfectly. Now, another question…

    I have blog-title and sf-menu on the same baseline in the header, or so it appears visually, with #branding and #access overlapping. Since #access is on top it’s keeping the blog-title link from working. How can I simply move sf-menu into the #branding div and delete #access? I tried to work backwards through the templates but it seems that everything it constructed with functions such that I cannot simply move divs or copy PHP code from one div to another. Please explain how to move stuff around. Thanks.

  10. Posted June 14, 2010 at 3:19 am | Permalink

    Hello Chris,

    I’m trying to use the style.css to make the colors on my header and footer extend all the way out to the edge of my browser. Just as if it were a liquid layout. I’m new to PHP, and I’m having the hardest time making the colors extend out to the edge of the browser.

    I am using the Thematic Options child theme, which I found online and downloaded for WordPress. I also had to change my server’s PHP from 4.4.9 to PHP 5 so that the theme would work.

    Can you please point me to the right code and where to change it in the style.css, etc?

    • Posted June 23, 2010 at 9:45 pm | Permalink

      Ok, after spending over a week with this problem, I stumbled upon a solution myself.

  11. egarcia
    Posted July 15, 2010 at 4:43 pm | Permalink

    I’ve been able to remove the sidebar from the home page.

    I was wondering if it’s possible to do the same with the menu bar (called “access” on thematic-lingo, I believe).

    It seems that there are no “filters” for “filtering out” the access bar. How would you go about filtering out the menu bar then?

  12. egarcia
    Posted July 15, 2010 at 5:06 pm | Permalink

    mm I think I found a solution:

    function remove_access_action() {
    add_action('init', 'remove_access_action');

    function splendeo_access() {
    if (!is_home()) {
    return thematic_access();

  13. Posted December 8, 2010 at 1:44 pm | Permalink

    Thank you Chris for your perserverant work with Thematic

    Now if we use for instance Context Widget and we would like to set the sidebar only for the frontpage then we have to change the CSS for the home.

    I wonder how is possible to make a CSS that collapse (width: 0%) the sidebar column when is empty so if there are no widgets to show. I mean that the CSS automatically expands the width sidebar only when there are widgets.

    I read many threats and the solutions are with specific CSS for home/page/category, but not dynamic

    Now is when I miss some Joomla templates that they collapse columns when there are not modules for one category or for a detailed post.

  14. Posted December 13, 2010 at 4:38 pm | Permalink


    Thanks for all the comments. I found it very helpful. However, how do I expand the space on all the pages (what is the code?) and not only on the homepage?

    I quote Chris for the home page changes:
    We open the child theme’s style.css and add the following code:

    body.slug-forum #container {
    width: 960px;
    body.slug-forum #content {
    width: 940px;


  15. Posted December 13, 2010 at 9:24 pm | Permalink

    I’ll publish a code snippet in the next days that will auto-hide the sidebar. The end of year rush is keeping me too busy at the moment.

  16. brian
    Posted December 21, 2010 at 5:38 pm | Permalink

    Thank you for for the clean code, properly implemented in the child theme. Cheers !

  17. Posted April 12, 2011 at 8:11 pm | Permalink

    I got the removal of the sidebar working but I can’t access the space.

    I’m using this but it doesn’t work.

    body.projectew #container {
    width: 960px;

    body.projectew #content {
    width: 940px;

    Can anyone help?

  18. Posted June 16, 2011 at 10:23 am | Permalink

    You’ve made my day! got sick of that sidebar…

  19. Greg Turner
    Posted June 17, 2011 at 5:45 am | Permalink

    I am confused by this thread, because thematic has multiple sidebars on a page. This code does not refer to removing a specific sidebar, so I am confused. I want to remove the primary aside sidebar on some pages, and remove the secondary aside sidebar on other pages. How can I do this? Thanks

  20. Posted June 24, 2011 at 5:05 am | Permalink

    Not sure if you’re still around. I’m currently using a child theme I made from Thematic however I can’t really seem to change anything. So far I’ve added a header… All I want now is to have my content centered instead of on the left side, and I’ve tried using this code but it doesnt change anything. Not sure what I’m doing wrong. Any help is appreciated.

  21. Posted August 19, 2011 at 8:45 am | Permalink

    I’m having the same trouble a plenty of other people… I can get rid of the side bar BUT can’t make use of that space. The page I’m working on is called Sandbox so I edited the CSS to read:

    body.sandbox #container {
    width: 960px;

    body.sandbox #content {
    width: 940px;

    It’s still not working though. check it out:

    Any words of wisdom would be hugely appreciated!

Post a Comment

Your email is never published nor shared.

You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

More in Widget Area (3 of 3 articles)