how to remove sidebar region from specific pages?
bmblack - September 13, 2009 - 00:44
I've got a page that I dont want my sidebar to display on. I tried simply disabling all the blocks within the region, but the sidebar region is still clearly there. There are no blocks inside of it, but the region still shows a different background color and wont let any content from the page flow into that area.
Could somebody please help?

It depends on the theme, the
It depends on the theme, the region is probably printed with something like
<div id="region-name"><?php print $region_name; ?>
</div>
It may be as easy as changing such code to
<?php if ( $region_name ) : ?><div id="region-name">
<?php print $region_name; ?>
</div>
<?php endif; ?>
but it depends on the theme, some will still "keep" the space.
I tried that and it didn't
I tried that and it didn't seem to work. I'm using the inove theme. Here's the code for the content on my page.tpl page. The page I dont want the sidebar on is called home. So the full address is www.mywebsite.com/home.
Sorry, I'm not very good with php - is there some sort of if statement that would say something along the lines of "if page does not equal HOME, then print sidebar"
<!-- content starts here -->
<div id="content">
<div id="main">
<?php if ($breadcrumb): ?>
<div id="postpath">
<?php print $breadcrumb; ?>
</div><!-- /postpath -->
<?php endif ?>
<?php print $tabs ?>
<?php if ($title) : ?>
<h1 class="title"><?php print $title ?></h1>
<?php endif ?>
<?php print $help ?>
<?php print $messages ?>
<?php print $content ?>
<?php print $feed_icons ?>
</div>
<div id="sidebar">
<?php print $sidebar; ?>
<?php print $left; ?>
</div>
<div class="clear">
</div> <!-- end main -->
This would not show the
This would not show the sidebar on the home page regardless of block settings
<?php if ( ! $is_front ) : ?><div id="sidebar">
<?php print $sidebar; ?>
<?php print $left; ?>
</div>
<?php endif; ?>
thanks, that code worked...
thanks, that code worked... kind of
The code did what it was supposed to do, but I think I just realized that simply removing the sidebar doesn't adjust the formatting of the page. All the blocks on the page just disappeared when I used that code. The sidebar was still visible though. I think maybe just bad css coding??
Is it possible to just use a different theme for a specific page?
A couple of choice Sections
A couple of choice Sections and ThemeKey
Not show header region on image galleries and image nodes
Hi, I have the same problem: there are two regions in my theme (custom theme that I bought) called "Header" and "Header2" that I would like not to show on image nodes.
Although I don't put any block or content in that region, a black box is always shown on every page. Have a look at http://www.tendeperinterni.it/ambienti/tende-per-interni-stripes
How can I avoid this? I think I have to tweak my css as well, but am not familiar with code and don't know what to add.
Thank you for your help.
Lets assume the region
Lets assume the region variables are $header and $header2.
Current code in you page.tpl.php probably looks something like
<div id="header"><?php print $header; ?>
</div>
<div id="header2">
<?php print $header2; ?>
</div>
You want the regions to conditional print only where there are blocks in them so you want code something like
<?php if ( $header ) : ?><div id="header">
<?php print $header; ?>
</div>
<?php endif; ?>
<?php if ( $header2 ) : ?>
<div id="header2">
<?php print $header2; ?>
</div>
<?php endif; ?>
You're great!
Thank you for the advice, I replaced the piece of code above adjusting the region variables and now my theme is perfect!
Really grateful, cheers.