Support » Plugin: Widget Logic » Widget Logic is_category displaying on homepage

  • I’m trying to display 2 sets of ads:
    1. Default ads (should appear everywhere except cat 2 & 3)
    2. Ads for category 2 & 3 pages and posts in either cat 2 or 3.

    This is what I have:

    Text:
    [Default AD CODE]

    Widget Logic:
    !is_category( array( 2, 3 ) ) && !in_category( array( 2, 3 ) )

    Text:
    [AD CODE for categories 2 & 3]

    Widget Logic:
    is_category( array( 2, 3 ) ) || in_category( array( 2, 3 ) )

    This is what’s happening:
    The ads meant for categories 2 & 3 are showing up on the homepage, on the categories 2 & 3 pages, and on posts in categories 2 & 3. It’s not supposed to show up on the homepage.

    The other ads meant for the rest of the site do show up on other category pages and posts pages that are not in category 2 or 3. They do not appear on the homepage.

    The weirdest thing about this problem is that sometimes it works… and sometimes it doesn’t. Any ideas?

    Thank you.

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • sometimes it works… and sometimes it doesn’t.

    possibly depends on which category the last post in the loop has (?)

    possibly integrate is_home() and/or is_single() into the conditional code.

    yep, you need to combine in_category with is_single, as in_category is true when the first or last (depending on the theme) post in the loop is in the specd category

    It’s mentioned in passing in a couple of points in the FAQ

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

    eg

    is_category( array( 2, 3 ) ) || (is_single() && in_category( array( 2, 3 ) ) )

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Widget Logic is_category displaying on homepage’ is closed to new replies.