Support » Fixing WordPress » suppress sidebar & header outside blog?

  • Resolved storyfirst


    I’m new to WordPress, so please be kind.

    Also: I did search here, and elsewhere and I read everything that even vaguely touched on what I need. And I’m still stuck.

    I’m using a variation on the Kubrick theme that I got off the wp/themes site (two sidebars right).

    I need to have Pages that are without distraction –just the text and the comment form, a simplified header, and a link to the front page.

    I tried to do this by commenting out the ‘get sidebar’ command on page.php, but no luck. I’m pretty proficient at html but I’m just learning php. I realize there must be some kind of conditional statement (show sidebar/header only on the blog pages), but (1) how to write it and (2) where to put it — I’m lost.

    As I said I did extensive searching, but if I somehow missed a thread that resolves this kind of issue, please point me in that direction. Otherwise any help would be greatly appreciated.

Viewing 4 replies - 1 through 4 (of 4 total)
  • storyfirst, Did you use html comment tags <!-- --> ?
    They don’t work in php. /* */ are comments in php.
    Try <?php /* get_sidebar(); */ ?> or delete the statement altogether.

    At the top of the file add:

    Template Name: Page_no_sidebar

    and save it as page_no_sidebar.php

    This page will now show up in your templates.
    Don’t remove the get_header command from your template.


    Thank you so much for that quick reply. I was using the php way of commenting out, but it didn’t work until I put it inside the sidebar statement as you showed in your example.

    So the sidebar is gone from those pages… but one unforeseen result is that the main column is still only as wide as it was. I’m thinking maybe css would be the way to specific a different page width for these non-sidebar pages?

    In html I would take the quick and dirty solution of putting some additional css at the top of the template to redine margins, but I haven’t seen that done with php.

    Any thoughts? And thanks again, I do appreciate your help.

    often a quick and dirty solution turns out to be slow and dirty.

    In your stylesheet add two classes:
    .narrowcolumn {width: XXXpx}
    .widecolumn {width:YYYpx}

    change the XXX and YYY to the width you want your page to be with or without sidebar respectvely.
    yui can remove width formats from the original id.

    in your templates page.php and page_no_sidebar add these classes to the div of your content e.g.:
    <div id="content" class="narrowcolumn">
    <div id="content" class="widecolumn">

    change the id="content" part to the id that is used in your template

    Thank you, macbrink. That was exactly what I needed to know. All resolved.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘suppress sidebar & header outside blog?’ is closed to new replies.