• I installed Widget Logic and it works great for almost everything. The only problem I am having is that for some reason it won’t exclude a widget on a page that I am using a particular template on. I have the following code:

    !is_page(array(144,174,146,208)

    It works for all of the pages except for page 146. I am using a template on that page that calls certain posts in a particular category:

    <?php
    $page = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts("cat=10&showposts=5&paged=$page");
    ?>

    The weird thing is that I am using the code:

    is_page(array(144,174,146,208)

    for another widget that I want to only show up on those pages and it works fine.

    Any ideas why I can’t exclude the widget from that page?

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • some possible things to try that might shed some light:

    what happens if you narrow down the logic to just !is_page(146) for widget A and is_page(146) for widget B?

    what happens if you don’t use that code in the template?

    does the ‘wp_reset_query’ option have any effect?

    Thread Starter blueyonder

    (@blueyonder)

    !is_page(146) still doesn’t work ??

    It does work if I remove the code from the page template, but I really need that code in there. Hmmm…

    Add this at the end of your template (before the call to your widget area):

    <?php wp_reset_query(); ?>

    Basically, your query is probably telling WP that you’re on a category archive rather than a page, so you need to reset it.

    i would love to know if the ‘wp_reset_query’ option (at the foot of the widget admin page) has any effect. it *should* have the same effect as greenshady’s suggestion.

    Thread Starter blueyonder

    (@blueyonder)

    Thanks Greenshady! That worked.

    The weird thing is that the ‘wp_reset_query’ option (at the foot of the widget admin page) didn’t work, but it did work once I added it to my page template.

    Thanks both of you for all your help!!!

    ok thanks. looks like i could do with checking out how well that option is working cos it’s meant to deal with exactly that sort of coding issue.

    cheers

    Thread Starter blueyonder

    (@blueyonder)

    Oh. I was wrong.

    Adding <?php wp_reset_query(); ?> woorked, but it reset the page so that my other code` <?php
    $page = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
    query_posts(“cat=10&showposts=5&paged=$page”);
    ?>` didn’t work ??

    I guess I can’t have both?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Widget Logic- Page Template not working’ is closed to new replies.