WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just need to say in single.php if post type = x then display y. Else, don't display it.

share|improve this question
if( get_post_type() == 'post_type_slug' ) {
    //do some stuff
} else {
    //do other stuff
}

Should do it, alternately you can use templates to handle that, which wordpress has setup pretty well by default. See the codex page on template hierarchy, specifically I find the visual overview to be quite useful.

share|improve this answer

Is this what you're looking for? (where 'product' would be the post type)

if ( is_singular('product') ) {
    // do stuff
} else {
    // do something else
}
share|improve this answer

It depends a bit on what exactly y is, but this should probably help you out: http://codex.wordpress.org/Conditional_Tags#A_Post_Type

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.