Support » Fixing WordPress » How to Remove Sidebar From All Pages Except Home Page?

  • HI. I’m using Magazine Basic theme ( So I want to remove the Sidebar from all pages except the front page. I’ve tried using the conditional statement stuff, but I’m not sure where to put this code:
    <?php if (is_page(‘x’)) : ?>
    <?php else : ?>
    <?php get_sidebar(); ?>
    <?php endif; ?>

    I’ve tried putting this to page.php and what happened was that all my pages displayed huge sidebars in the centre of the page. I also tried doing that custom template stuff. I created a new php file in cpanel, but it doesn’t appear when I create a new page ( actually there’s no dropdown menu with an option to choose template at all). So I think I should edit this code in footer.php:

    $loc = pbt_theme_option(‘sidebar_location’);
    if($loc==2 || $loc==4) {
    get_sidebar(); // calling the First Sidebar
    if(pbt_theme_option(‘sidebar_width2’)!=0 && $loc!=3) get_sidebar( “second” ); // calling the Second Sidebar
    <!– begin footer –>

    BUt I’m not sure. COuld somedoby help me? Cheers

Viewing 3 replies - 1 through 3 (of 3 total)
  • Sorry that you havent had an answer until now… IDK if you have had this question answered by now. But, here is my siggestion!

    Just install the “Dynamic Widgets” plugin!

    It uses the sidebar area’s you already have, and you can change what sidebar widgets (or, in your case, the sidebar in general) show on what page.

    Hope this helps!

    Here are easy steps:

    1. COPY everything from the index.php into notepad
    2. CREATE a new file named page-home.php and paste everything from index.php and remove the sidebar and make changes you want for homepage also add this on top:

     * Template Name: Home Page

    3. Name the php file page-home.php

    4. Go to Pages in wordpress and select the ‘Home Page’ template and publish (It will override anything you do in the post, tags, etc.)

    5.Go into WordPress > Settings > Reading Settings
    and select ‘Home Page’ for front page and your done.

    You may want to do kaformedia’s idea with a child theme, so that the page-home.php file doesn’t get deleted in the next update

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to Remove Sidebar From All Pages Except Home Page?’ is closed to new replies.