I'd like to call a custom sidebar whenever a single custom post type is displayed. I have a custom post type, "report", and the corresponding single post page, single-report.php which is a verbatim copy of the original file single.php file with a different header and sidebar call, but I cannot get the custom sidebar to appear. On the other hand, the default sidebar "Secondary Widget Area" shows up, if I revert the sidebar call to default. It seems that this is done by design, that the default is forced upon the archive, single post and home pages, or whenever the main loop is present.
<?php /** * Template Name: Report Page * The template for displaying all single Reports */ get_header('research'); ?> <div id="primary" class="content-area"> <div id="content" class="site-content" role="main"> <?php /* The loop */ ?> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content-report', get_post_format() ); ?> <?php twentythirteen_post_nav(); ?> <?php comments_template(); ?> <?php endwhile; ?> </div><!-- #content --> </div><!-- #primary --> <?php get_sidebar('research'); ?> <?php get_footer();?>
Can I create a page template and use it as a single custom post page? Use conditional tags on the main loop to change the sidebar?
In the only instance where I saw this issue addressed, the developer used Genesis Extender, which is not my case.