WordPress.org

Ready to get started?Download WordPress

Forums

Widget Logic
[resolved] exclude from category -both category landing and single posts (3 posts)

  1. streettb
    Member
    Posted 1 year ago #

    I need some help with the correct logic...I'm trying to have a widget appear across my blog EXCEPT for in a category (the widget should NOT appear in both the category landing page and single posts of that category).

    This logic is not working:

    !( is_single() && in_category ('how-to-not-look-like-a-freshman')) || !is_category ('how-to-not-look-like-a-freshman')

    The widget is not appearing on the category landing page (which I want), but is showing on the single posts in the category...

    how do I properly form !( is_single() && in_category ('how-to-not-look-like-a-freshman')) so that the widget won't appear in the single posts of the category?

    http://wordpress.org/extend/plugins/widget-logic/

  2. alanft
    Member
    Plugin Author

    Posted 1 year ago #

    the opposite of that, to make it appear on a category page or single posts is in the FAQ as

    is_category(X) || (is_single() && in_category(X))

    so reverse that with !( … ) around it like this…

    !( is_category(X) || (is_single() && in_category(X)) )

  3. streettb
    Member
    Posted 1 year ago #

    Yes, that logic works - many thanks for your quick reply!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic