Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #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?

    #446074

    I 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.

    #446819

    However 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!

    #446831

    Hi!

    This could work:
    http://codex.wordpress.org/Function_Reference/has_term

    Cheers!
    Josue

    #447036

    Hi,
    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 use

    is_term ( ' ' )

    or smth like this in Widget Logic filter. Is that correct?

    Alex

    #447388

    Hi!

    The conditional has to be something like this:

    if( has_term( 'books', 'product_cat' ) ) {
        // do something
    }

    Cheers!
    Josue

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.