I am learning how to create new templates in WP. I am using a child theme of Twenty Eleven.
My problem is that whenever I create a new template the layout breaks. For debugging I stopped using any customizations and simply copy-pasted-renamed the file sidebar-page.php
from Twenty Eleven into my child theme’s directory.
The only adjustment I made to this file is that I edited the Template Name:
at the start of the file.
However what happens is that while selecting the original “Sidebar” template the layout works, when I select my new custom template, the layout breaks. What happens is that the content moves to the center and the sidebar gets positioned below the content, not next to it.
Can you tell me why is this happening and what do I need to edit/copy to fix it?
I was having the same problem as the OP, when working in a child theme and copying the sidebar-page.php file to make my own template file (named register.php).
Then I noticed in the original template pages, in the body tag there is a class ‘.page-template-sidebar-page-php’ whereas in my new template it was showing up as ‘.page-template-register-php’
So I’m editing style.css (in my child theme folder) to add ‘.page-template-register-php’ wherever ‘.page-template-sidebar-page-php’ appears, but that wasn’t all.
There was also a class ‘singular’ in my new style. I had to edit my child theme functions.php and add ‘&& ! is_page_template( ‘register.php’ )’ into line 613 ‘s if clause. then it worked