Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.
Tagged: conditional tags, tag
I’ve been trying to use conditional tags to display/hide content but most of the WP or WooCommerce conditional tags seem not to work with Symbiostock.
What I want to do. I’d like to display a widget only for products (stock images) of a particular image category. Or only for products which have a particular tag.
I’ve tried
>>> is_product_category( ‘my_image_category_name’ ) <<<
>>> is_product_tag( ‘one_of_the_image_tags’ ) <<<
>>> is_category( ‘my_image_category_name’ ) <<<
>>> is_tag( ‘one_of_the_image_tags’ ) <<<
>>> has_tag( ‘one_of_the_image_tags’ ) <<<
but none of these return a result.
Symbiostock does not alter the way tags are stored by WooCommerce or WordPress so if it is not working, it likely has nothing to do with Symbiostock. I briefly read the codex page on conditional tags and see that it has some restrictions in bold – you may have to ensure that it is being called at the right time to be effective.
Note: You can only use conditional query tags after the posts_selection action hook in WordPress (the wp action hook is the first one through which you can use these conditionals). For themes, this means the conditional tag will never work properly if you are using it in the body of functions.php.
You must be logged in to reply to this topic.