Forums

Arrays do not work correctly on Widget Logic (8 posts)

  1. bluebird2
    Member
    Posted 3 weeks ago #

    Widget Logic is an excellent and useful widget for me. For me it works fine with Conditional Tags such as
    is_page('42')
    But when I use arrays like
    is_author(array(3,4,5))
    or
    is_category(array(3,4,5,'Stinky Cheeses'))
    it does not work.

    What might be a problem?

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

  2. alanft
    Member
    Posted 3 weeks ago #

    i just tried an is_author(array( ... )) on my install and it worked ok. sorry.

    have you tried to see if the problem persists on the WP default theme?

  3. bluebird2
    Member
    Posted 2 weeks ago #

    I tried it on other themes. It still has the same problem. Is it possible that the problem is caused by conflicting with other plugins? I try to disable other plugins to see how that might fix the problem.

    Two more questions:
    1. You also suggest "ticking the wp_reset_query option". Where is that? I cannot find it anywhere on the widgets and in the Setting.
    2. I cannot combine two widgets using "widget logic" in the same page. It only shows one of them (the very first one). Is it normal or this is another bug on my site?

  4. alanft
    Member
    Posted 2 weeks ago #

    http://wordpress.org/extend/plugins/widget-logic/screenshots/
    "The widget_content filter and wp_reset_query options are at the foot of the widget admin page."

    TBH the wp_reset_query is for larger problems than using the 'array' variations of those conditional tags.

    so if you can get is_category(3) || is_category(4) to work ok instead of is_category(array(3,4)), then the problem is not going to be addressed with that option.

    of course, that's a workround too. not a nice one, but it would work. and if so, i have zero idea why the 'array' versions are not working for you. sorry

  5. bluebird2
    Member
    Posted 1 week ago #

    Checking the "wp_reset_query" didn't work either.

    These are the issues I have had with the plugin during the last few days:

    a. I have two widgets showing a list of posts with certain tags, that are supposed to show up in a certain category. One of them shows up the other does not even though they both are supposed to show up in the same sidebars on the same category posts (using widget-logic).

    b. I tried to show certain widgets on certain category archive pages using this
    is_category(X,Y,Z)
    but they do not show the widget.

  6. alanft
    Member
    Posted 1 week ago #

    is_category(X,Y,Z) isn't a valid use of the is_category tag.

    http://codex.wordpress.org/Conditional_Tags#A_Category_Page

    is_category(array(X,Y,Z)) is ok and should work. but if it's not for whatever odd reason you could try resorting to

    is_category(X) || is_category(Y) || is_category(Z)

    and so on. try to break it down to see where your code is going wrong. start with one category with is_category(X). if that works, try adding an 'OR this category' to make it work with 2 and so on.

  7. physalis
    Member
    Posted 1 day ago #

    Hi there,
    I have the exact same problem. I am combining like the following:
    is_page(array(30,20,25,26)) OR in_category(array(1,6,7,8)) OR is_category(array(1,6,7,8)) or, but that does not change anything, like:
    is_page(array(30,20,25,26)) || in_category(array(1,6,7,8)) || is_category(array(1,6,7,8)), and the same goes for a reduced one like:
    is_page(array(30,20,25,26)) || is_category(array(1,6,7,8)) or even if I split it up into single categories/pages to avoid arrays.
    Any insight on this? Does this happen to others as well? Did bluebird happen to have it solved in some way?

    I might add up that I use five different widgets, all with different conditions.

  8. alanft
    Member
    Posted 1 day ago #

    if is_page(30) doesn't work then there might be a general problem with the code in your theme resetting query info. check that it works in the WP default theme. and if that stops the problem, you can TRY the wp_reset_query option

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

Reply

You must log in to post.

About this Topic