WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

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 am using Event Manager and they have a custom post type of events, with a taxonomy of event-categories (separate from regular post categories). In that taxonomy I have created terms(?) or event categories, "Education" and "Research". I want a specific <div> to show up if a post is in the event-categories taxonomy with the term/category of "Education". The slug is "education" and the tag_ID is 8. Currently I'm trying to use this code snippet, but I'm not getting it. I know there's more to it, but I haven't been successful with other tutorials. Most are for category archives. I need it conditionally for single posts.

   if(in_category('education')) {
      echo '<div>test</div>';
share|improve this question
up vote 4 down vote accepted

in_category() is conditional tag for taxonomy 'category'. With custom taxonomies you should use has_term() conditional, first parameter is term to check for and second is taxonomy.

if ( has_term( 'education', 'event-categories' ) ){
    echo '<div>Test</div>';
share|improve this answer
Worked perfectly. Thank you! – chris_s Mar 30 '12 at 19:00
@chris_s you're very welcome. – Mamaduka Mar 30 '12 at 21:24

Your Answer


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.