Support » Alpha/Beta/RC » POSSIBLE BUG? function is_post_type() works oddly

  • 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. Nonetheless the file stats-hotel.php is being included when viewing every post type I have, 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:


    Then the file stats-hotel.php is never included when seeing any type of post type.

    This seems like a bug to me… Or am I wrong?


Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘POSSIBLE BUG? function is_post_type() works oddly’ is closed to new replies.