Ready to get started?Download WordPress


Problem with Conditional Tags (1 post)

  1. johnsalomon
    Posted 4 years ago #

    Hi all,

    I am using the Widget Logic plugin, and it works great except for one problem -- with a single pair of categories, I cannot get widgets to display correctly with conditional tags.

    I have two subcategories -- let's call them 'foo' and 'bar'. Foo is category 54, bar is category 190.

    I have a widget that I only want to show up if something is in category foo, and another, similar widget for posts in category bar that should only show when I'm in category bar or on a post in that category. For a post in both categories, both widgets should show.

    Conditional tags for "widget_foo" and "widget_bar", respectively, are

    is_category('54') || (is_single && in_category('54'))
    is_category('190') || (is_single && in_category('190'))

    Both categories have multiple posts.

    I have a single post that is in both foo and bar. Because of this, whenever I have category 'bar' open, or a post in category 'bar', both widget_foo and widget_bar display. If I have a post in category 'foo' open, only widget_foo displays (which is what is supposed to happen.)

    If I remove category 'foo' from that one single post, then only widget_bar displays in category bar.

    I have attempted deleting category bar and re-adding it, removing/re-adding the widgets in question, what-have you.

    The actual site is

    http://blog.zog.net/bars/ ('bar', ha ha) and
    http://blog.zog.net/restaurants/ ('foo')

    Driving me nuts, I tell you. Anyone?

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.