Support » Themes and Templates » Remove sidebar from just one page.

  • Hello all!

    After hours of searching the forums, I managed to get the answer to the above question.

    On my page.php file I edited the <?php get_sidebar(); ?> to:

    <?php if (!is_page(‘forum’)) : get_sidebar(); endif; ?>

    As you can see, the page I didn’t want the side bar on is the Forum page.

    This worked a treat. However I was then left with a huge blank space where the sidebar use to be (a problem that occurred for most people). To get around this I added the following to my page.php file:

    <div class=”<?php if (!is_page(forum)) : ?>content<?php else : ?>nosidebar<?php endif; ?>”>

    And created the nosidebar attribute in my style.css sheet.

    This has worked fantastically. The home page has the side bar, the forum doesn’t and is correctly scaled across the entire page.


    When I click on any other page other than home or forum, the side bar is centered and under all the content. Why is this…?

    Please let me know if you need anymore information or code.

    Thank you in advance!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Michael


    Forum Moderator

    have you really just added this line?
    because, if you have, you would need to close the div somewhere.

    you might be able to change the css class in an existing div with the conditional code.

    please post a link to your site to illustrate the problem.

    Thanks for the quick response.

    The website page that is working is and

    If you click register, login etc you’ll notice the side bar is under the content and centered. This site has only been up a couple of days so still learning!

    I’ve put that code under <div id="content">.

    So looks like this:

    <div id="content" >
    <div class="<?php if (!is_page(forum)) : ?>content<?php else : ?>nosidebar<?php endif; ?>">
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <div class="post single" id="post-<?php the_ID(); ?>">
    <div class="title">
    <h2><a>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>

    [Please post code or markup snippets between backticks or use the code button.]



    Forum Moderator

    have you added a closing div as well?

    try and use the to check if the </div> is missing in the pages.

    Hello, I have a problem with full width content on a single post page… I followed “The Sweeper” instruction and turned off the sidebar of “journal’ category off but know the sidebar is not there but the content is still 570px instead of 100% = 900px Can someone help me please? Here is the link to the page:




    Forum Moderator

    @one with life: It is considered impolite to interrupt another poster’s thread. Please post your own topic.

    oh sorry i am very new to all this… and i fix it already. Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Remove sidebar from just one page.’ is closed to new replies.