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.

Using twenty-eleven theme, need to change default template for new page from standard to sidebar.

anyone?

share|improve this question
add comment

2 Answers 2

I would hook into the new_page action, and then use update_post_meta() to update the post meta value for _wp_page_template:

<?php
function wpse31124_set_page_default_template( $page_id ) {
    update_post_meta( $page_id, '_wp_page_template', 'sidebar-page.php' )
}
add_action( 'new_page', 'wpse31124_set_page_default_template' );
?>

You could hook into other actions, but they might stomp on your ability to use the default template. Using new_page will ensure that the callback only changes the page template meta data value when a new page is created initially.

share|improve this answer
add comment

If it wont mess you up you could switch the template file names. Although every time the theme is updated you would probably have to do this over and over again.

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.