• Hey all,

    I’m sorry to write in with such a rudimentary question, but I’ve searched around and tried it several ways, and I’m not sure what I’m missing.

    Here’s what I want to happen:

    If the current post has a post type “families,” include the file “placement-status.php”. Otherwise, do nothing.

    Here’s what I have:

    <?php
    if (is_singular('families')) include 'placement-status.php';
    else NULL;
    ?>

    Please and thank you!

    Adam

Viewing 2 replies - 1 through 2 (of 2 total)
  • If this code is in a loop showing multiple posts, then is_singular() will return false. Try this instead:

    <?php
    if ($post->post_type == 'families') include 'placement-status.php';
    else NULL;
    ?>
    Thread Starter Adam Rubinstein

    (@gourmetbooks)

    Thanks! I’ll give it a shot on Monday.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘If is a custom post type, include this’ is closed to new replies.