WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to extend the twentyeleven theme's sidebar template. My custom template (its incomplete) is as follows:

 * Template Name: Quote Request
 * Description: A Page Template that is a free quote request form
 * @package WordPress
 * @subpackage Twenty_Eleven (Custom)
 * @since Twenty Eleven 1.c
get_header(); ?>

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

                <?php while ( have_posts() ) : the_post(); ?>

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

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

                <?php endwhile; // end of the loop. ?>

            </div><!-- #content -->
        </div><!-- #primary -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>

I just name a copy of sidebar-page.php which I belive is used for creating Sidebar template pages. But I don't get the intended results. Here is what I get:

My template result

But when I select the sidebar template from the editor, I get:

Sidebar template

I am trying to acheive this before I add my custom page elements. Can somebody point me to correct direction? I am just starting on wordpress.

share|improve this question
What are you trying to do? I don't get it? – kaiser Feb 28 '12 at 12:41
I assume the issue is the page content width not changing on your custom page template, thereby causing your sidebar to be pushed beneath the page content? – Chip Bennett Feb 28 '12 at 13:15
up vote 1 down vote accepted

you need to correct the automatically added body_class .singular to get the layout;

for instance use this in functions.php of your child theme (which you should have created to work from):

add_filter('body_class', 'pagetemplate_adjust_body_class', 20, 2);
function pagetemplate_adjust_body_class($wp_classes, $extra_classes) { 

if( is_page_template('new-sidebar-page-template-file-name.php') ) :
// Filter the body classes     

      foreach($wp_classes as $key => $value) {
      if ($value == 'singular') unset($wp_classes[$key]);

// Add the extra classes back untouched
return array_merge($wp_classes, (array) $extra_classes );

if you are working with a clone of Twenty Eleven, see near the end of functions.php and expand this line with your page tempalte:

if ( is_singular() && ! is_home() && ! is_page_template( 'showcase.php' ) && ! is_page_template( 'sidebar-page.php' ) )
share|improve this answer
Mihael, thanks for the answer. +1 for introducing the child theme concept to me. :) – Abdel Raoof Feb 28 '12 at 15:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.