WordPress.org

Ready to get started?Download WordPress

Forums

Page Template (8 posts)

  1. BelvidereGreen
    Member
    Posted 4 years ago #

    On the theme, under template options for pages there seems to be no option for sidebar removal. Is there a way to have a page without a sidebar?
    Thanks

  2. The best way to do that is to edit the template page.php
    In your admin go to Appearance > Editor
    Navigate to the page.php

    Look for <?php get_sidebar();?>
    It should be near the bottom
    Just delete that sentence.

    You may want to do a ctrl x just in case you need to put it back in there using a crtl v.

    Good luck

  3. BelvidereGreen
    Member
    Posted 4 years ago #

    Thank you for your help. I am looking to do it for just one particular page. Would your suggestion erase it for every page?

  4. It would yes.

    What you can do instead is check to see if it's that page or now using an if statement.

    Something like this:

    <?php if (is_page(pageidgoeshere)) ?> {
    echo '';
    }else {get_sidebar();}?>

    The pageidgoeshere corresponds to your page number.

  5. MichaelH
    Member
    Posted 4 years ago #

    You may want to make small correction:

    <?php
    if (!is_page(pageidgoeshere)) {
      get_sidebar();
    }
    ?>
  6. BLichtenwalner
    Member
    Posted 4 years ago #

    Thanks for this tip gang, but it does not seem to work in the latest version. The content of the sidebar is gone, but the column remains. Any other suggestions? Example with the above implemented (I just deleted the line from the page template in this instance):

    http://modernservantleader.com/about/comments-policy/test-only/

  7. BLichtenwalner
    Member
    Posted 4 years ago #

    Found it. I also had to remove the <div id="content"> and closing tag. That did it.

  8. Joni
    Member
    Posted 4 years ago #

    I sometimes create a second page template called wide-page that doesn't have a call to the sidebar and also has a #wide-content division with adjusted width.

    Then you can use that template anytime you want when writing a page; just use the dropdown and choose it.

Topic Closed

This topic has been closed to new replies.

About this Topic