Thanks to alchymyth at TransformationPowerTools for this one – looks like WordPress’ twentyeleven theme seems to have a few annoying tricks up it’s sleeve.
When you try and add a new page template for the twentyeleven theme like I’ve done, it’ll add the .singular CSS class to the page when it shouldn’t for some reason, and that messes up the sidebar and pushes it to the bottom below the comments box. There’s a simple fix (read: hack) to sort this out, which alchymyth has posted:
If you are creating a new page template for a child theme of Twenty Eleven, with a sidebar, you need to correct the body_class output to remove the css class .singular.
add_filter('body_class', 'adjust_body_class', 20, 2); function adjust_body_class($wp_classes, $extra_classes) { if( is_page_template('page-alt.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 hope this will help someone else!