Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
    
it looks like the parent css is not being carried over to your child theme. Are you by chance not referencing the parent template in your child template? –  rexposadas Jan 13 '12 at 17:54
    
as @rxn said, your style.css should contain Template: twentyeleven within it's details, as explained here: codex.wordpress.org/Child_Themes –  OleVik Jan 13 '12 at 21:25
add comment

1 Answer 1

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

share|improve this answer
add comment

Your Answer

 
discard

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.