Environment: WP 3.5, Twenty Twelve child theme. I created a custom template. Now, I'd like to display the built-in sidebar-2 in this custom template page (instead of the default sidebar-1). sidebar-2 is already registered by twenty twelve functions.php. I read a bit about get_sidebar and how to activate other sidebars, but I'm still a bit confused. To activate sidebar-2 on this custom template I created a file sidebar-customtemplate.php in my child theme directory with this content:
<?php if ( is_active_sidebar( 'sidebar-2' ) ) : ?>
<div id="secondary" class="widget-area" role="complementary">
<?php dynamic_sidebar( 'sidebar-2' ); ?>
</div><!-- #secondary -->
<?php endif; ?>
Then in my custom template file I replaced get_sidebar();
with <?php get_sidebar( $customtemplate ); ?>
. Then I added some widgets to the sidebar-2 (from Appearance - Widget), but in the home page still sidebar-1 is displayed! Why? :(