Well, today i faced a little problem on checking whether a page displaying on WordPress site is using a custom taxonomy post type. I need to determine whether that particular page is using a custom taxonomy post type and that particular page is using a particular custom taxonomy post category as well. In this case, i search a bit but couldn't find this answer easily which resulted me to write this in the case i need this in the future as well.
In order to find whether a particular page is a custom taxonomy category type, we test with the following sentence
if(is_single()){ } else if(is_tax('reviews', $term = 'Games')){ $args = array( 'post_type' => 'reviews', 'showposts' => 72, 'tax_query' => array( array( 'taxonomy' => 'review_category', 'field' => 'slug', 'terms' => 'games' ) ) ); }else if(is_tax('reviews', $term = 'Apps')){ $args = array( 'post_type' => 'reviews', 'showposts' => 72, 'tax_query' => array( array( 'taxonomy' => 'review_category', 'field' => 'slug', 'terms' => 'apps' ) ) ); }else $args = array( 'post_type' => 'reviews', 'showposts' => 72);
My custom taxonomy is 'reviews' and i wanted to check whether a particular page is type 'Apps' or 'Games', this way i am able to determine whether the particular page is using a custom taxonomy category which is different from using is_category which check post category.