Support » Plugins » Widget Logic on 2.8

  • Resolved alanft


    Just to announce that the current release of WL doesn’t work fully on 2.8. When you hit ‘Save’ in a widget the AJAX way, the widget comes back without the WL field. refresh the page and it’s there again (and the changes have saved??) – but it’s still teh suck.

    so I have updated the code to make it work with this new bit of 2.8, and it’s available as v 0.46 in the ‘development version’ on the versions page.

    If I don’t hear anything adverse about it (say if it breaks anything important in 2.7, or there’s something else new in 2.8 that i’ve missed) in the next couple of days, I will tag it up as an official update.

Viewing 15 replies - 1 through 15 (of 19 total)
  • doctoraa


    I’ve discovered that the logic can only handle simple cases such as Is_home(); anything more complex doesn’t work for me. I’m trying to have a widget appear only on the home page and two other pages, but it is completely unresponsive to the “or” || operator. I haven’t tried the “and” && operator. It’s also not clear what number to give to a widget when some of the widgets aren’t supposed to appear on every page. Can they be clashing with each other? I’m not sure if these problems are due to the upgrade to 2.8 since I never tried out compound logical statements before today.

    Justin Tadlock


    WordPress God

    Thanks for the update. I recommend this to pretty much all my theme users, and I’ll let them know an update will be ready soon.



    doctoraa. give me an example of a complex case that isn’t working. Also “what number to give to a widget”. Where do you give numbers to a widget?

    (if you mean the order in the sidebar in the non-javascript admin interface, it’s the order of the widgets regardless of whether they appear.)

    greenshady – it would be great if you could try out the ‘dev’ version and let me know what you think.

    cheers all.

    Justin Tadlock


    WordPress God


    Will do just as soon as I wake up tomorrow.



    @alanft: Thanks for the update. I’m currently testing it on 2.8 with one widget and a condition like this:

    is_singular() && in_category('foo') && in_category('bar')

    … and it seems to work fine.



    Here’s an example of a complex statement that I haven’t had any success with:

    is_home() || is_page(‘Page One’) || is_page(‘Page Two’)

    I also tried

    (is_home() || is_page(‘Page One’) || is_page(‘Page Two’))


    (is_home()) || (is_page(‘Page One’)) || (is_page(‘Page Two’))

    In each case, the widget only appeared on the home page. Maybe I am misuing the syntax; clearly, it is not reacting to the || symbols.

    With the numbering scheme, if I have three widgets in Sidebar 1 on the homepage, but I only want the first two plus a new one on Page One, would I rank the new widget as 3 or 4 in Sidebar 1? I tried both with no success.



    OK, I finally discovered where the problem was. There were two screwups on my part. I was using the name that appears on the tab of each page, which is a shortened version of the actual page name. Now I see that the actual page name must be used. Also, I wasn’t paying close enough attention to the case of the page name. I used upper case for the page name, but upper and lower on the tabs. The case has to match the actual page name.

    Thanks for your time, alanft!



    thanks everyone.

    doctoraa, glad the logic sorted out for you in the end. wrt numbering scheme – i’m still not sure what that means – do you just mean the order of appearance in the sidebar in the admin interface?

    if you want ABC on is_home() and ABD on is_page(X), then you just define widgets ABCD with C set to appear on is_home() and D set to appear on is_page(X) with A and B defined as normal with no logic (or more complicatedly: is_home() || is_page(X))

    a couple of bonus tips wrt is_page, you can use the page ID, slug or title, and you can even give it an array of mixed IDs/slugs/titles to check against.

    Justin Tadlock


    WordPress God

    So far, everything seems fine to me. I’ve tried several different complex mixtures of tags and all has been well.



    cool. it’s good to know the logic is working as before.

    what was worrying me was the behaviour of the WL fields in the new 2.8 widget admin interface. I spotted just the one problem (described above) and I’ve fixed that. If anyone spots any other issues, holler.

    I’m going to try and test the new wp_query_reset code myself, and then I’ll make the release official tomorrow I guess.

    Thanks again greenshady, and all here on the forums.



    in case you hadn’t noticed I did tag up 0.46 as a full release.

    I’ve also added a donate URL for the first time – it’s a page to raise money for Cancer Research UK. It would be wonderful if even just a fraction of the downloads WL gets would donate 5 UKP/USD.

    Thanks to everyone again for all your feedback.

    Hi Alan,

    I am having a problem that has appeared to others as well. I have a home page specified as Home (slug “home”) and a blog page set as a page titled Blog (slug “blog”).

    Using the is_page(‘blog’) the widget does not appear on the blog page. I also took the approach of using:

    !is_page(home) || !is_page(about) … etc. for the other pages

    to try and exclude the widget from pages other than the blog page but I must be doing something wrong. it does not work either.

    I have tried the page ID option too, but I am not sure I am actually using the page ID.

    Do you have any ideas why this is not working?

    WP 2.8.1
    Theme K2

    read about is_home() and is_front_page() here

    I’ve got the same issue dwhitedesign speaks of. I can add any widget to the page I have designted “Blog” when not using WL, but when using it no widget appears. I have read about home vs front page but have not had any success with that.

    Any help would be greatly appreciated!

    Just a tip for anyone who is trying to use Widget Logic only on the home page:

    I tried the is_home() to put a widget only on my home page but it never worked no matter how I tried it. The solution is to NOT use that conditional tag. Instead use this:


    That will work. WordPress seems to have a hard time determining which page is the Home page for some reason but it knows which page is the front page.

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Widget Logic on 2.8’ is closed to new replies.