Title: Problem With Conditional Tags
Last modified: August 18, 2016

---

# Problem With Conditional Tags

 *  [Joe Hall](https://wordpress.org/support/users/redbmedia/)
 * (@redbmedia)
 * [18 years, 9 months ago](https://wordpress.org/support/topic/problem-with-conditional-tags/)
 * Hey Folks,
 * I am having a problem with conditional tags. I want a special message to appear
   above all of the post that are in category 12. Therefore I am using the following
   conditional tag
 *     ```
       <?php if(is_category('12')){echo 'This Is Category 12';}?>
       ```
   
 * However, this tag only works on category templates and archive templates. It 
   does not work on single post templates. Does anyone know why? And, does anyone
   know how I can display a special message on single posts that are in a certain
   category?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [dredub38](https://wordpress.org/support/users/dredub38/)
 * (@dredub38)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/problem-with-conditional-tags/#post-621580)
 * I am looking for the answer to this problem as well.
 * What I am trying to do is say ‘if this post is in category 13, then insert the
   contents of this php file’.
 * Specifically, I want to insert an subscription link in the header of any post
   that is in my podcast category, no matter where the post shows up – main index,
   archive, single post, etc.
 * I spent 2 hours looking on the forums, and another hour trying to figure it out
   using google. I apologize if I’ve missed the answer somewhere. Thanks in advance
   for any help you brainy folks can offer.
 *  [bpartch](https://wordpress.org/support/users/bpartch/)
 * (@bpartch)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/problem-with-conditional-tags/#post-621582)
 * Hello
 * Try:
 * `<?php if(is_single() && in_category('12')){echo 'This Is a single post filed
   in Category 12';}?>`
 * Hope it helps. 🙂
 *  [dredub38](https://wordpress.org/support/users/dredub38/)
 * (@dredub38)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/problem-with-conditional-tags/#post-621583)
 * BPartch, that absolutely helped _me_. I was able to modify it a little and it
   solved the single post part of my problem. (Thank You!)
 * `<?php if(is_single() && in_category('13')){include ('podcast-feed.php');}?>`
 * A little more fiddin’ with it and I got it to work on my main index page as well
 * `<?php if(in_category('13')){include ('podcast-feed.php');}?>`
 * My problem was that I was trying to use is_category rather than in_category
 * Thank you so much for your help.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Problem With Conditional Tags’ is closed to new replies.

## Tags

 * [category](https://wordpress.org/support/topic-tag/category/)
 * [tags](https://wordpress.org/support/topic-tag/tags/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [dredub38](https://wordpress.org/support/users/dredub38/)
 * Last activity: [18 years, 8 months ago](https://wordpress.org/support/topic/problem-with-conditional-tags/#post-621583)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
