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>';

1 Answer 1


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>';
  • @chris_s you're very welcome.
    – Mamaduka
    Commented Mar 30, 2012 at 21:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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