I have tried every possible way of making this conditional work and it's skipping the in_category conditionals and going to the last option. This is my code in single.php:
$post = $wp_query->post;
if (in_category('Autos')) {
get_template_part("single-autos.php");
} else if (in_category('Advertising')) {
get_template_part("single-ads.php");
} else {
get_template_part("single-post.php");
}
I have conditionals all over this theme that work by calling the in_category
for those two categories, but no matter what I do, this conditional always reverts to the single-post.php layout. single-autos.php and single-ads.php do exist in the theme.
Is there something I'm doing wrong?
Thanks!
Edited to add the code from single-autos.php:
get_header();
<div id="blogcontent" class="auto">
if (have_posts()) : while (have_posts()) : the_post();
get_template_part( 'loop' );
comments_template();
<div id="singlepagination">
<div class="newer">< next_post_link(); > </div>
<div class="older">< previous_post_link(); > </div>
</div>
endwhile; else:
<h2>Thank you for pushing the self-destruct button. This ship will self destruct in ten seconds.</h2>
endif;
</div><!--/content-->
get_sidebar();
get_footer();
echo
something likeA/B/C
inside theif/elseif/else
to see that it's not a typo or similar. – kaiser Feb 3 '12 at 6:51