WordPress.org

Ready to get started?Download WordPress

Forums

Widget Logic
How to use Widget Logic with Woo Commerce product categories? (6 posts)

  1. pekkizz
    Member
    Posted 1 year ago #

    Hello!

    I want to show my widget only on certain Woo Commerce product categories, like this here:

    http://www.catchline.fi/Woo/product-category/kaunokirjat/

    I have tried all these; but no results:

    is_category(array(59))

    is_category('59')

    in_category('59')

    is_category(‘59’) || (is_single() && in_category(‘59’))

    I got some help from Themify / Pinshop Support, and they told me this much:

    "
    No, it's not a page, it's an archive. You can use Widget Logic to set a widget specifically for archives of the product_cat taxonomy.

    You could probably use a conditional tag such as is_tax('product_cat') as documented here: http://codex.wordpress.org/Function_Reference/is_tax

    Thanks.
    "

    But I am just a human, not a code demon, so please tell me what to do here?

    Pekka

    http://wordpress.org/extend/plugins/widget-logic/

  2. alanft
    Member
    Plugin Author

    Posted 1 year ago #

    just a guess but it looks like they are saying you just need to use the is_tax tag. something like

    is_tax( 'product_cat', 'kaunokirjat');

    or the ID of that product_cat ID instead of the slug string

  3. pekkizz
    Member
    Posted 1 year ago #

    Thank you!

    I really do not know how to code at all, so I found this plugin doing the work for me just great:

    http://wordpress.org/extend/plugins/widget-context/

    I got the sub-product categories easily in! no coding at all :)

    Anyway I know your plugin is THE LEADER :)

  4. alanft
    Member
    Plugin Author

    Posted 1 year ago #

    good stuff.

  5. Jason Kemp
    Member
    Posted 1 year ago #

    I would have used this syntax - I have found getting the category name wrong sometimes stops the widget from working.

    Using in rather than is being the key

    in_category( 'categoryname' )

    is_category( '59' )
    When the archive page for Category 59 is being displayed. So this is to do with archive pages

    And this is slightly different

    in_category( '59' )
    Returns true if the current post is in the specified category id

  6. robertodimarco
    Member
    Posted 1 year ago #

    Hi! I'm using widget logic, but i can't show widget in subcategories.... how can display it? Thank u

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.