• Resolved glastonbomb

    (@glastonbomb)


    So I’ve been looking around to find a way to get rid of my sidebar in all of my static pages BUT make it show up in my blog page. From searching, all I found was ways to make different content show up in the sidebar. I want to completely remove it and make the space it is regularly taking up useful to my static pages.

    From what I know, I need to use If statements. Also I figured out I should modify the code in my index.php file. Particularly edit the call for the sidebar so if it’s viewing my news/blog page (my front page is static by the way and my blog is actually page id 2) then it will show the sidebar and ifelse don’t show the sidebar.

    <?php get_sidebar(); ?> is what I need to change. Does anyone know how to do this? I understand it in theory but I’m completely unsure of how to write the code.

    It sounds so simple but I have no idea on how to use the if statement to show a sidebar and for everything else don’t show it.

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Roy

    (@gangleri)

    If you mean ALL pages, why not just remove the get_sidebar argument from pages.php and leave it in index.php, single.php, archive.php, etc.?

    Thread Starter glastonbomb

    (@glastonbomb)

    Thanks–I just tried that and it got rid of the sidebar but there’s still an area that’s unusable. There’s an area left that the content won’t go onto. Any ideas?

    Thread Starter glastonbomb

    (@glastonbomb)

    Thanks Gangleri.
    After implementing that change, it came down to breaking my “main” and “text” div tags into two groups, one for the blog and one for the rest of the site (where I called them “main2” and “text2”).

    It then came down to a css issue of taking out the right margin that was keeping the text from running into the space where the sidebar used to be.

    g7kse

    (@g7kse)

    Glastonbomb,

    I have had the same problem and haven’t managed to find an answer. So far I have made a new page template and removed the side bar by deleting <?php get_sidebar();?> but like you still have the unused space that I can’t seem to fill.

    can you give a bit more detail about the solution as I’ve been bored by this problem for long enough. If it’s the CSS then can you give a before and after your changes and I’ll see if it works with my template

    many thanks

    Alex, g7kse

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Remove sidebar for static pages, keep for blog’ is closed to new replies.