Support » Plugin: Widget Logic » Not working with some widgets?

  • Hi there,

    I have been using your plugin for years, on many different sites, and this is the first time I have had an issue, so hoping we can sort it out.

    I use Headway theme.

    I had the plugin set up to show different ad units for my 3 main site categories, and a 4th to show on all other pages/posts.

    This actually works fine for the ad unit in the header, as this is actually custom code added via the theme functions file. But the exact same logic statements do not work when used in widgets in the theme side bar (so for elements created with the Headway visual editor)

    The is mobile condition does work though, as does the is a certain single post (using post number) just not the conditions to show if is/ isn’t a category.

    I have had to put up just the one widget at the moment (because it was showing all of them), which is showing on all posts – the conditions/logic statement used (that works perfectly in the header widget) is

    is_category(4638) || (is_single() && in_category(4638))

    Here is a link to a post NOT in that category that it is showing on –

    Any ideas what could be causing this?


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


    i’m afraid I only have generic troubleshooting ideas for you.

    The most useful this you can use is a generic PHP widget that you can do things like

    echo "4638 check=".is_category(4638);

    which is a bit involved. Slightly simpler but possibly more long-winded would be try breaking it down in the widget logic with a test text widget set to appear under bits of your logic to see which bit isn’t evaluating correctly, e.g. just

    in_category(4638) as widget logic – perhaps that bit isn’t working for some reason, and you can work back from that if it’s not. perhaps switching themes to see if the problem goes away, and then you have something to work on where the problem arises.

    hope that’s some help

    I’m not sure if I’ve got the same issue or not but it sounds similar.

    Kate – if you split your widget logic up, does the issue still occur?

    Ie try with just (is_single() && in_category(4638))

    and separately


    I’m getting a similar issue, where the logic works if I only use one query at a time. I’m trying to do !is_home() || !is_category('research') || !in_category('research') on an ‘enhanced text’ widget

    They work individually (ie !is_home() on it’s own, or !is_category(‘research’) on it’s own etc) but when I combine them it stops working.

    Perhaps a similar issue, perhaps not – and might help with troubleshooting. I hate to say it but as I’m trying to remove elements, I’ve used CSS to hide it as I can’t get this to work.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Not working with some widgets?’ is closed to new replies.