WordPress Page with No Sidebar in Weaver II

Often, it’s useful to be able to display a WordPress page with no sidebar to allow full width content. I recently needed to do just that for a site using the Weaver II theme, and thought I’d share what worked. First you will want to make a copy of wp-content/themes/weaver-ii/page.php and save it as something like pagenosidebar.php. You will want to replace the comment at the top Standard page output (Default template) with Template Name: No Sidebar (This comment is essential to getting the page template choice to show up in the menu for your admin Edit Page screen.) Next, the php call to display the sidebar needs to be commented out. My site uses a left sidebar, so I commented out weaverii_get_sidebar_left('page'); If your site uses a different sidebar location, just comment out the appropriate get_sidebar call. The final step is to add a style override to the content area so it will fill the space. Otherwise you just see a big hole where the sidebar used to be. For this theme that looks like <div id="container_wrap"<?php weaverii_get_page_class('page'); ?> style="width:100%;text-align:left;"> Below is the code for my No Sidebar page template. Be sure to place your modified page template in the same directory as page.php Code that has been added or changed is marked in green.

<?php
/**
 * Template Name: No Sidebar
 *
 * @package WordPress
 * @subpackage Weaver II
 * @since Weaver II 1.0
 */

weaverii_get_header('page');
if (weaverii_getopt('wii_infobar_location') == 'top') get_template_part('infobar');
weaverii_inject_area('premain');
echo("\t<div id=\"main\">\n");
weaverii_trace_template(__FILE__);
/*** weaverii_get_sidebar_left('page'); ***/
?>
		<div id="container_wrap"<?php weaverii_get_page_class('page'); ?> 
style="width:100%;text-align:left;">
<?php	if (weaverii_getopt('wii_infobar_location') == 'content') get_template_part('infobar');
		weaverii_inject_area('precontent'); ?>
		<div id="container">
<?php		weaverii_get_sidebar_top('page'); ?>

			<div id="content" role="main">

				<?php weaverii_post_count_clear(); the_post(); ?>

				<?php get_template_part( 'content', 'page' ); ?>

				<?php comments_template( '', true ); ?>

			</div><!-- #content -->
<?php		weaverii_get_sidebar_bottom('page'); ?>
		</div><!-- #container -->
		</div><!-- #container_wrap -->

<?php	weaverii_get_sidebar_right('page');
	weaverii_get_footer('page');
?>
This entry was posted in Web Services, WordPress Nerd Info and tagged . Bookmark the permalink.

4 Responses to WordPress Page with No Sidebar in Weaver II

  1. Hi Ian,
    I love your digital graphics, and your generous and kind spirit, which is reflected in your work, and your blog… I just wanted to tell you that I think your fantasy landscape is AMAZING! It reminded me of the graphics in WILD DIVINE software and I love it!
    God Bless and Keep Creating parallel universes for those of us who live in multiple dimensions!
    Melinda

  2. Thank you, thank you, thank you!

  3. Weaver says:

    This solution to modify page.php is totally unnecessary!

    If you want a single page wide page (one column), simply select the “No sidebars, one column content” option from the “Select Sidebar Layout for this page – overrides default Page layout.” option on the Per Page options visible in the Page editor. That will work for the Default, as well as other Page Templates.

  4. Matt says:

    Thanks Weaver – easy solution and works.

Leave a Reply to Laurie Cameron Cancel reply

Your email address will not be published. Required fields are marked *