Support » Plugin: Widget Logic » Combining conditions

  • Resolved HelenMoss



    I have some widgets that I do NOT want to show on the blog page OR any of the single post pages (only on the pages I am using as part of my website, not as part of my blog). If I use this: !is_single() it works,
    If I write: !is_page(‘blog’) that works
    But if I write this:
    !is_single() || !is_page(‘blog’) nothing works.

    In short, it seems I am doing something wrong once I combine the conditions, they only work when there is one of them. Can anyone shed any light please? I’ve spent a couple of hours trying to figure it out already!

    Thanks so much!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor alanft


    you need to use && AND instead of || OR, because what you want to say is

    “show the widget (when it’s NOT single) AND (when it’s NOT page X)”

    if you put OR in there you’ll always get the widget except when it’s single and page X

    Thanks for your quick reply.

    I tried your solution and with
    !is_single() && !is_page(‘blog’)
    the widget is hidden on the single post pages but not on the main blog page. On that blog page it is still showing and I don’t want it to show there. I only want it on the other pages (which are my website, rather than my blog).

    Can you explain why?

    Thank you very much!

    Plugin Contributor alanft


    sorry – I missed it was your main blog page. the is_page(‘blog’) probably wouldn’t work then. You’ll likely need is_home() or is_front_page() depending on how you’ve got your site setup. Seeā€¦

    Thanks for your reply, !is_home() worked!

    It doesn’t make a lot of sense to me, maybe I’m not logical enough to understand widget logic! lol! No matter, the most important thing is that I can achieve what I want to, so thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Combining conditions’ is closed to new replies.