Support » Plugin: Widget Logic » Conditional tag doesn't work when I use "||" for multiple categories

  • Resolved msolda1

    (@msolda1)


    I am trying to hide a particular widget for all posts in 2 categories and show it on the rest. It works when I have the code for only one category:

    This works:

    !in_category(‘category1’)

    Then when I try the following, it doesn’t work. The widget still shows on both:

    !in_category(‘category1’) || !in_category(‘category2’)
    as well as
    !in_category(‘category1’, ‘category2’)

    I also tried the following, and when I do this, it hides the widget completely everywhere
    !in_category(‘category1’ || ‘category2’)

    Any suggestions?

    https://wordpress.org/plugins/widget-logic/

Viewing 3 replies - 1 through 3 (of 3 total)
  • I too am having this problem but with pages.

    this works:
    in_page(‘OAS Home’)
    and
    in_homepage(”)

    this does not work
    in_page(‘OAS Home’) || in_page(‘Gallery’) || in_page(‘Outreach’)

    I also tried array:
    in_page(array(‘OAS Home’,’Gallery’.’Outreach’))

    Both of these give me errors posted at the top of the pages.

    Any suggestions please?

    I saw this on another post and tried it but it didn’t work either:

    is_page(‘OAS_Homepage’) && is_page(‘Gallery’) && is_page(‘Members’) && is_page(‘Outreach’)

    FIXED!!!
    I don’t know why, but this worked:

    is_page(array(249,19,737,OAS_Homepage))

    The numbers are the pages and since the designated homepage isn’t given a number, I had to spell it out.

    Hope this helps.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Conditional tag doesn't work when I use "||" for multiple categories’ is closed to new replies.