-
AuthorPosts
-
May 18, 2015 at 7:56 pm #445999
I can control widget appearance on product categories using this conditional tag (widget added to ‘Displayed Everywhere’ widget area)
is_tax( 'product_cat' , ( array( '11', '12', '13' ) ) )I would like to add specific widgets to specific single product pages (‘Single Product Pages widget area’). Whatever conditional tags I try – they either freeze up the page (it becomes blank white at reload) or do not have any effect on widget behavior at all. It just shows up on every single product page.
Can you help?
May 18, 2015 at 10:31 pm #446074I figured it out. That’s how to assign widgets to a specific single product page:
is_single( 1 )
or
is_single( array( 1, 2, 3 ))Numbers represent single product ID’s.
May 20, 2015 at 12:42 am #446819However I still have a task to solve and I will be appreciated for little help.
Instead of manually adding each single product ID to a certain array I would like to use the tag that will automatically display the ‘A’ widget on every single product page from ‘A’ category, ‘B’ widget on every single product page from ‘B’ category, etc
I know it’s possible, but couldn’t find the right tag up till now, even at a Woocommerce website. Can anybody give a hint on this, please?
Tnx!May 20, 2015 at 1:00 am #446831May 20, 2015 at 11:18 am #447036Hi,
Yep, this is it. but it seems a bit harder then simply adding a tag to a Widget Logic filter (wish I was an experienced coder).
As I understood I have to edit category.php first and then useis_term ( ' ' )or smth like this in Widget Logic filter. Is that correct?
Alex
May 20, 2015 at 7:39 pm #447388Hi!
The conditional has to be something like this:
if( has_term( 'books', 'product_cat' ) ) { // do something }Cheers!
Josue -
AuthorPosts
- You must be logged in to reply to this topic.
