[wp-hackers] Widget API, Widget Wrapper Functionality
Shane A. Froebel
shane at bugssite.org
Mon Jan 18 16:47:27 UTC 2010
-----BEGIN PGP SIGNED MESSAGE-----
After going through all the scenarios that I can go through on my head I
come up that the Widget API system for MU might be problematic
especially if each MU has a different theme with it.
Right now we use:
$args = array(
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => "</li>n",
'before_title' => '<h2 class="widgettitle">',
'after_title' => "</h2>n"
register_sidebar( $args );
This is fine for single blogs where there is only one theme to edit and
worry about, but if a MU site starts to support many different styles of
theme, this way might be beneficial to all MU site owners where they
don't have to worry about 2 or 5 CSS files to maintain.
In my ticket (http://core.trac.wordpress.org/ticket/11387) has grater
detail on how it would work, but instead of all widgets doing all the
"echoing" of all the data they would return the only their data and the
Widget Walker and them theme if specified would use it's walker based on
the content type that the widget wants to return. 'li', 'ol', 'ul',
'div', 'p' or 'none' to allow the proper formatting.
Instead of before_widget and after_widget they would have
'before_output' and 'after_output' so that the default WordPress theme
would still work. Theme authors can specify if they want the
before/after_output values to be in their walker.
The custom walker is initialized by a filter called 'widget_design' that
would return 'new Theme_Walker_Widget();'.
I can see the objections now, but just think about the concept of
maintain widget css when you can have the theme authors do it correctly
the first time.
Thanks for your time.
Your Friend, Shane
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
-----END PGP SIGNATURE-----
More information about the wp-hackers