• Resolved thorshammer

    (@thorshammer)


    I’ve implemented the Widget Logic plugin, to control widgets based on is_home() etc. But I want a widget to appear on every page EXCEPT the homepage, and all the Conditional Tags start with an “is” rather than a “not”.

    Am I overlooking one? Or is there a different (better) approach to avoiding the Homepage for widget placement?

Viewing 7 replies - 1 through 7 (of 7 total)
  • php logical operator negation:

    http://www.php.net/manual/en/language.operators.logical.php

    example:
    !is_home()

    Thread Starter thorshammer

    (@thorshammer)

    Thanks alchymyth,
    As mentioned I am using the Widget Logic plugin, which only accesses WP Conditional Tags… so the question remains:
    How can I test for NOT being the Homepage, in order to place a widget? It would be unfortunate to have to stick with IS_ (a true result). That would not only mean a bunch of pages to test – as in your original response:
    !is_page('events')
    …but would also require UPDATING, whenever another page gets added. An untenable solution.

    It seems to me that wanting to see content show up on everything BUT the Homepage is a fairly common occurrence. Any other ideas?

    How can I test for NOT being the Homepage

    i edited my reply very shortly after posting it –

    for not showing something on the home (blog) page, try:

    !is_home()

    or check through all the available conditional tags:
    http://codex.wordpress.org/Conditional_Tags

    Thread Starter thorshammer

    (@thorshammer)

    Again thanks Alchymyth – the winning entry was: !is_front_page().

    !is_home() had no effect, but I suspect that is due to setting my homepage to an actual “page”. Moving along now… cheers!

    Lesley

    (@cornucopia-design)

    I’m also using Widget Logic but need a conditional tag to not show a widget in one particular page. I’ve tried to guess using the information given above but it doesn’t work. If I have a page called ‘book now’, I want the widget to show on all pages except ‘book now’. What do I have to put? I’m no code expert. Many thanks.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Lesley – If it’s a page you can use is_page()

    http://codex.wordpress.org/Function_Reference/is_page

    So for widget logic you’d put !is_page('book-now') probably (if that’s the page slug).

    Lesley

    (@cornucopia-design)

    Thanks Ipstenu, that worked!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘need a Conditional Tag for a NOT condition’ is closed to new replies.