Widget Logic
Widget logic not working in 1 of 3 widgetized sidebars, using same code in al (2 posts)

  1. skyekilaen
    Posted 5 years ago #

    I'm using Widget Logic on a client blog because I'm familiar with it. I have 3 widgets I need to suppress on any single post pages in a specific category, so here's what I'm putting in the Widget Logic field:

    ! ( is_single() && in_category('1168') )

    In 2 of the 3 widgetized areas where I'm using it, it works fine, the item doesn't appear on the one single post page that is currently in that category. Everywhere else I've looked, it's still there, so that's good.

    In the right sidebar, however, I put in the same code, and it does not suppress the widget I need to remove. I tried it on a different widget in that sidebar, same thing.

    I'm happy to do my own troubleshooting but I'm somewhat unclear where to start. Same behavior after I checked the wp_reset_query box.

    Any ideas appreciated. I do not have the ability to reset to a default theme for troubleshooting unfortunately, so I know that's going to limit my ability to figure out what's going on. I'm basically just posting this just in case someone has an idea or a hint, I don't expect y'all to do a bunch of work but if anything occurs to you, let me know. :)

  2. alanft
    Plugin Author

    Posted 5 years ago #

    you could troubleshoot by installing a PHP widget and then in the PHP code in widgets use print_r() to see what's going on with the various conditions you are using.

    eg print_r(in_category('1168'))

    to see what is getting returned by those tags under those circumstances - chances are some code is getting executed in the theme code after sidebar 1 and 2, but before sidebar 3 that's resetting various wordpress 'state' variables

    if you are feeling strong, try looking in the theme code for where the sidebars are invoked, and see if there is any code doing something complex with queries.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic