• Resolved HelenMoss

    (@helenmoss)


    Hi

    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!

    https://www.ads-software.com/extend/plugins/widget-logic/

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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

    Thread Starter HelenMoss

    (@helenmoss)

    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!

    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…

    https://codex.www.ads-software.com/Conditional_Tags#The_Main_Page

    Thread Starter HelenMoss

    (@helenmoss)

    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.