I am using the Woocommerce plugin. I am trying to create a different container for when I am displaying multiple products then when I display multiple categories.
So far in my archive_products
I have a check for is_shop()
and if it is then it means that I am displaying categories and not products. So I load my category style containers.
The problem is that if the category has sub categories and you click to see those sub categories, you are now failing the is_shop()
function.
How can I still know if I am up to displaying available products or if I am displaying subcategores?
I think the conditional you’re looking for is:
You can see the docs at Conditional Tags
A bit of Google searching seems to indicate that this isn’t always reliable, depending upon your scenario. See here on WordPress codex.