WordPress.org

Ready to get started?Download WordPress

Forums

[closed] POSSIBLE BUG? function is_post_type() works oddly (2 posts)

  1. pmdci
    Member
    Posted 4 years ago #

    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:

    is_post_type('garblegarblegarble')

    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?

    Regards,
    P.

  2. MichaelH
    Member
    Posted 4 years ago #

    Continue discussion here:
    http://wordpress.org/support/topic/402823

Topic Closed

This topic has been closed to new replies.

About this Topic