troubleshooting Question

Wordpress PHP - How to show a div only if it is in a specific category within a custom Taxonomy

Avatar of Member_2_7966984
Member_2_7966984 asked on
14 Comments1 Solution14 ViewsLast Modified:
Hello - I am trying to show a div only if it exists within a specific category in my custom taxonomy

here is what I have but nothing is showing up so guessing I'm missing something

         <!-- Category back buttons -->
          <? if ( is_tax( 'project-category', '5' ) ) { ?>
            <!-- Retail -->
               <a href="/category-retail/" title="view more retail projects">View More Retail Projects</a>
         <? } ?>
          <? if ( is_tax ( 'project-category', '20' ) ) { ?>
            <!-- Education -->
               <a href="/category-education/" title="view more retail projects">View More Education Projects</a>
         <? } ?>            
         <!-- End Category back buttons -->

Open in new window

this is a custom post type with slug "project" that has a custom taxonomy with slug "project-category" on my singles page.

within my custom taxonomy "retail" has a category id of 5 and "education" has a category id of 20 

I want to only display the div and its contents only if the specific category id is associated with the post on the singles page...

David H.H.Lee
Digital Marketing (Hospitality)
Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 14 Comments.
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>


Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 14 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004