Troubleshooting Page Templatein TwentyTwelve Child
-
I have a Twenty Twelve child theme that I’ve created. I am trying to make a custom page template for the home page that uses its own right-hand sidebar.
The trouble is, when I pull the custom page template together with the new sidebar, the sidebar is not showing when that template is applied to the page. I cannot figure out what I’m doing wrong. I never had trouble creating custom templates in Twenty Ten. What am I doing wrong with this Twenty Twelve child theme?
I created the new widget area in the child functions php. It works, I’ve added a couple of widgets to it.
Using the 2012 pages as reference, I’ve created page-library.php and sidebar-library.php. I’ve tried placing them in the page-templates directory and I’ve tried placing the in the theme root directory.
Here’s the sidebar-library.php. I’ve double checked and triple checked – the new widget area I’ve created for this custom page is
sidebar-4
.<?php /** * The sidebar containing the custom home page widget area. * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ ?> <?php if ( is_active_sidebar( 'sidebar-4' ) ) : ?> <div id="secondary" class="widget-area" role="complementary"> <?php dynamic_sidebar( 'sidebar-4' ); ?> </div><!-- #secondary --> <?php endif; ?>
Here’s the code for the page-library.php:
<?php /** * Template Name: Library Home Page Template * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ get_header(); ?> <div id="primary" class="site-content"> <div id="content" role="main"> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content', 'page' ); ?> <?php comments_template( '', true ); ?> <?php endwhile; // end of the loop. ?> </div><!-- #content --> </div><!-- #primary --> <?php get_sidebar(library); ?> <?php get_footer(); ?>
I have gone to my site home page and applied the “library” template to the page.
Please clue me in to what I’m missing, please!
- The topic ‘Troubleshooting Page Templatein TwentyTwelve Child’ is closed to new replies.