Hi there,
I added the following conditional in my sidebar.php template, before the check for widgets:
<?php if ( is_single() && is_post_type('hotel') ) { include 'stats-hotel.php'; } ?>
The is_single() conditional works fine. So it only includes the stats-hotel.php file when viewing single posts.
HOWEVER the is_post_Type() function doesn't work properly. In my case, besides the default post type I also have hotel and resort as post types. Nonetheless the file stats-hotel.php is being included when viewing every post type I have (post, hotel, resort), when it should only be included when seeing the post type hotel.
HOWEVER, if I change the is_post_type() argument and add some garble (i.e.: an unexistent post type), for example:
is_post_type('garblegarblegarble')
Then the file stats-hotel.php is never included when seeing any type of post type.
Am I doing something wrong, or this is really a bug?
Regards,
P.