Support » Plugins » WP 2.1 Causes Problems in PHP Widgets

  • Resolved msmeritt


    I just upgraded to WP 2.1. I was/am running the Executable PHP Widget ( and had three instances in my sidebars all working fine before the upgrade, but only one of them works now that I’ve upgraded. The two bits of code that don’t work are pretty basic PHP. Post-upgrade, they are not producing errors, but neither are they working the way that did before the upgrade, and I can’t understand what would be wrong. I’d appreciate any advice. Here are the details:

    1) This bit of code gave me a list of all my top-level categories with no subcategories.

      <?php wp_list_cats(‘sort_column=ID&children=0&list=1&hide_empty=0’); ?>

    But now, I get my full, hierarchicalized category list!

    2) This bit of code put a logo on the particular pages noted, while putting nothing in that widget spot on any other posts/pages:

    <?php if (is_page(‘140’)||is_page(‘141’)||is_page(‘142’)||is_page(‘143’)||is_page(‘156’)||is_page(‘234′)) { echo “<p style=\”text-align: center;\”><img id=’image180′ src=’/media/potluck-creative-arts-logo-150-wide.png’ alt=’Potluck Creative Arts’ /></p>”; } ?>

    Now, nothing shows up even on the indicated pages!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Ah, found a solution to #1 at Still working on the others…

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    The ExecPHP widget works fine (it’s too generic to have been affected by the upgrade), it’s the code inside the widget that isn’t working.

    #2: Did you check that your pages didn’t get renumbered? Might try referencing them by name in the is_page call instead.

    I agree that the ExecPHP widget is working fine — two other instances are fine, including one which hadn’t been but only as a result of a change in the WP function I was using, which I then fixed.

    I hadn’t checked, but I did now on your suggestion, and the pages are numbered the same as they were. I used numbers precisely because ID codes in a database are not supposed to change, while I thought there may be a chance I’d change page names. Even if I don’t change page names, names are problematic here, because in this case one of the pages I need to reference is called “Contact” with slug “contact,” and this page name and slug are repeated on a different page elsewhere in the page/subpage hierarchy. But the is_page tag seems to have no way to reference a page’s hierarchical place, only its name or slug or ID. Since name and slug will be problematic, I’m left with ID.

    The main puzzle here is that the PHP was working fine for the last several weeks, and it only stopped working once I upgraded to 2.1. Perhaps is_page has changed its functionality as in the other case I had? But I see no documentation that says it has changed. And other that is_page, this is just basic PHP with an “if” and an “echo” — I can’t imagine why this wouldn’t be working.

    Ah, well, funny, just to see, I checked my site again, and now it’s working. Go figure. I guess this is resolved. I’m learning to accept a resolution with mystery as opposed to demanding to understand everything, so I’ll take this just fine 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WP 2.1 Causes Problems in PHP Widgets’ is closed to new replies.