1

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?

2
  • 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, 2012 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, 2012 at 21:25

1 Answer 1

2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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