Support » Theme: Twenty Eleven » New Sidebar Template Not Working in Twenty Eleven

  • Resolved progresst


    I have a new installation of WP and am using Twenty Eleven. On this page I use the Template: Sidebar Template which from what I can tell uses the sidebar-page.php and it displays fine:

    I make an EXACT copy of the sidebar-page.php to another file called sidebar-preinsulated.php and choose that as the Template: Sidebar Template Preinsul for this page and the sideline suddenly drops down below the content:

    I have compared both pages using Firebug and cannot figure out why simply changing the file name and choosing this as the template is breaking this page? It appears to be exactly the same? What am I missing?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Michael


    Forum Moderator

    don’t edit twenty eleven directly; create a child theme and make the edits there.
    it is important to have an unedited default theme in case of theme problems. also, any customisations of twenty eleven will be overwritten with the next upgrade of your wordpress version.

    about the sidebar:
    look into functions.php of Twenty Eleven, a few lines from the end:

    if ( is_singular() && ! is_home() && ! is_page_template( 'showcase.php' ) && ! is_page_template( 'sidebar-page.php' ) )

    that is the section where the sidebar appearance is controlled.

    in the child theme of twenty eleven, add this to functions.php:

    this should get your sidebar and page into the right position.

    @ alchymyth…awesome, thanks!

    I have added the following code to my child functions.php file,

    add_filter(‘body_class’, ‘adjust_body_class’, 20, 2);
    function adjust_body_class($wp_classes, $extra_classes) {

    if( is_page_template(‘sidebar-preinsulated.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 );

    I have more then one page template and this piece of code only works for one page template. Is there a way to modify this to add additional page templates ?




    Forum Moderator

    put all page template files using the || (OR) operator into the if statement:

    if( is_page_template('sidebar-preinsulated.php') || is_page_template('another-page-template.php') || is_page_template('more-page-template.php') ) :

    Thank you for your help, that worked like a charm !

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘New Sidebar Template Not Working in Twenty Eleven’ is closed to new replies.