2

On Twenty Eleven or on its child themes the default template for new pages is a template with no sidebar. I don't know why this is like this; it seems to me that the designers of Wordpress are still not thinking about CMS functionality in some places.

For example the most obvious place to put a menu in a CMS is the sidebar. But with Twenty Eleven the only way to show a menu in all pages is to explicitly set all the pages to "sidebar template". I would think it's a design bug, as the only solution so far is to tell everyone to "don't forget to set the new pages to "sidebar template"".

I'm sure there must be a single line in functions.php which changes the default action but I don't know what that line is. Could you tell me what should I write in functions.php to set all new pages to "sidebar template" when using Twenty Eleven?

I'm sure that it has been asked before but I really couldn't find it anywhere using the search function.

1 Answer 1

1

just add <?php get_sidebar(); ?> to page.php in your child theme and all pages will have a sidebar. look at sidebar-page.php to see where to place it.

3
  • OK, but then I am modifying page.php. Isn't there a way to keep it minimalistic for the child theme, thus preserving all future updates to page.php?
    – hyperknot
    Oct 10, 2011 at 16:29
  • @zsero - you can hook save_post and add post meta with key _wp_page_template and sidebar-page.php as value. or I suppose you can add some javascript to the post edit screen that auto-selects a template.
    – Milo
    Oct 10, 2011 at 16:52
  • This will brake the site's design unless you play around with the CSS and the position of the article.
    – jnns
    Mar 6, 2012 at 10:13

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.