The MU forums have moved to WordPress.org

widgets plugin and text box (17 posts)

  1. PleaseHelp
    Member
    Posted 17 years ago #

    I have widgets plugin inside mu-plugin folder, it works ok but when I try to modify a text box I get:

    Warning: call_user_func_array(): First argumented is expected to be a valid callback, '' was given in /path-to-site/wp-content/mu-plugins/widgets/widgets.php on line 645

    I follow this guide: http://jason.lah.cc/2006/04/07/widgets-as-an-mu-plugin-on-wordpress-mu/

  2. drmike
    Member
    Posted 17 years ago #

    Ignore that and just follow the instructions that come with the widget download.

    - Unzip in the mu-plugins subdirectory

    - Move the scriptaculous directory to the wp-includes/js one.

    - Edit the two instealled themes.

    - Move widgets.php out of the widgets subdirectory and up a level to the mu-plugins one.

    Should work fine.

  3. kahless
    Member
    Posted 17 years ago #

    drmike,

    You said you were working on widgetizing some themes for MU. How hard is it? I've got a couple of themes I'd like to widgetize. I think there is info on the WordPress Codex, but haven't really looked.

  4. andrea_r
    Moderator
    Posted 17 years ago #

    Not hard at all:
    http://automattic.com/code/widgets/themes/

    The biggest hurdle (at least what I've seen in the wp.org forums with people having trouble) is to remember to place the closing end/if in the sidebar.

    Short version: (assuming sidebar is "standard")
    - drop the first half of the call right under the sidebar ul
    - drop the end/if right before the ending ul
    - stick the function call in functions.php

    The rest is troubleshooting themes that have wonky sidebars. (and the way the Pages and Links functions display and are coded, but that's a rant for another time...) I've widgetized about 40 themes on our site, and attempted a good 20 more (some weren't worth the bother).

  5. drmike
    Member
    Posted 17 years ago #

    Some of them are a pain to get widgets in there.

    Seems like I'm going to have to write my own Search widget to get it to match up a little better.

    I can release them as i go if you want.

  6. kahless
    Member
    Posted 17 years ago #

    I'm trying to widgetize (English is such a terrible language) treacle. It has a leftbar.php and rightbar.php. I've added the appropriate code to each (n is 1 or 2)

    if ( !function_exists('dynamic_sidebar')
    || !dynamic_sidebar(n) )

    closed the if and added

    if ( function_exists('register_sidebars') )
    register_sidebars(2)

    to functions but I get

    Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /path/wp-content/mu-plugins/widgets/widgets.php on line 58

    So it seems that it is not passing an array but it works for some other themes with two sidebars which are not in separate files. It is clearly a problem with something I've done but nothing in the Widget API seems to address this (or at least not that I understand). Suggestions?

  7. samchng
    Member
    Posted 17 years ago #

    andrea for the short version, why is it that you drop the call right under ul? It should be under a div and before and ul. endif to be after ul and before div.

    example:

    <div id="sidebar">
    <?php if ( !function_exists('dynamic_sidebar')
    || !dynamic_sidebar() ) : ?>
    <div class="title">About</div>
    This is my blog.
    <div class="title">Links</div>

    <?php endif; ?>
    </div>

  8. samchng
    Member
    Posted 17 years ago #

    ops... the code is taken from automacttic link above. Go check it out.

  9. kahless
    Member
    Posted 17 years ago #

    Got it. I had to put
    <?php
    if ( function_exists('register_sidebar') ) {
    register_sidebar(array(
    'name' => 'Leftbar',
    'before_widget' => '',
    'after_widget' => '',
    'before_title' => '<h2>',
    'after_title' => '</h2>',
    ));
    register_sidebar(array(
    'name' => 'Rightbar',
    'before_widget' => '',
    'after_widget' => '',
    'before_title' => '<h2>',
    'after_title' => '</h2>',
    ));
    }
    ?>

    in functions.php and then put
    <?php
    if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Rightbar') ) : ?>

    in the rightcolumn.php file. Similar for leftcolumn.php. Guess I just didn't understand the API had to hunt for a theme that did something similar.

  10. andrea_r
    Moderator
    Posted 17 years ago #

    Doh, you're right sam. Was doing it from my faulty memory. :)

    And yeah, kahless you've found out if it has more than one sidebar and it not what Automattic considers to be "standard markup" then there's a few extra things to add.

    But once you've done a dozen or so, it's no biggie. :D

  11. samchng
    Member
    Posted 17 years ago #

    No worries, andrea. You're busy with all the kids over at your place and also so many things at hand. Can hardly blame ya. :)

  12. unreachable
    Member
    Posted 17 years ago #

    I have the widgets control panel works on IE but not on mozilla/firefox... is anybody experience the same?

  13. drmike
    Member
    Posted 17 years ago #

    Is javascript turned on for that browser?

  14. unreachable
    Member
    Posted 17 years ago #

    sure... javascript is turned on all browser...

  15. andrea_r
    Moderator
    Posted 17 years ago #

    scriptalicious files in the right place?

  16. unreachable
    Member
    Posted 17 years ago #

    I think i found the anomalies... when the widget plugin firstime is installed, the sidebar control panel works perfectly (i could drag and drop and get every widgets setting).

    day after, when i update the blog into latest nightly, then i use the "upgrade" feature (on the wpmu admin menus), suddenly widgets sidebar is not responding to drag and drop, and throwing error on javascript console...

    on the other hand, new blog that created after i do "upgrade" is not affected (the sidebar widget control panel working correctly).

    the widget sidebar control panel is not responding again when I do "upgrade"...

    maybe someone could verify the same?

  17. unreachable
    Member
    Posted 17 years ago #

    I've upgraded the site to the latest nightly (801) and the widget problem is gone...

    i don't know what the problem, but you guys rocks!

    thank you all...

About this Topic

  • Started 17 years ago by PleaseHelp
  • Latest reply from unreachable