I'm using WooCommerce
on our site along with their Brands add-on to be able to group products together by brand - I know WooCommerce
has it's own built in selection of hooks and filters but I want to write a function that checks if I'm on a Brand page or not because as far as I can tell it piggybacks WooCommerce
post types to display the information.
I have used get_post_type()
on both a normal WooCommerce
category and product page, and also when I'm on a Brand page but all three come up with the custom post type of product
. I know that the Brands plug-in uses a custom taxonomy of product_brand
somewhere but I'm not sure how I can write a query to check if the page I'm on has this taxonomy.
If I run the following query…
$terms = get_terms( 'product_brand');
print_r($terms);
I get all of the brands that we have setup showing on the page.
Can anyone point me in the right direction?