[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-----
Hash: SHA1

Hey all!

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
http://bugssite.org/





-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)

iQIcBAEBAgAGBQJLVJCeAAoJEC7/vS6gbNwF8ugP/jGBU8YhY92MvB0CBJahhmOh
iAftnzzFHHKOkuqugsaxtyICQdrbAlwRy8DeFmeCRBVQ5yixIIT7ySXVVxvw5BO/
LDbSgtnA6JwFfcRbVPg8Oer0//bVVMTQjnJpEEnjt0HBGKsAMtbMaXxho35vKkIp
ITKHO1Hud6PfdaX0s0YLHK9tKs1YOjBuU/2v5hZpQEAr44h9ofWDc+50ywg01EO5
BMIXIkYFq98kykfFyCNI/FlMcIOGWxXHN18CukN0yNQW6HDjxq+VBqsPdXZ0vLh/
ohLn9kfjXvdI4ndZwGo5Ehf+Tb0EXQAB/AmFtufjcBmSzD0OVSFWxDlaCpljwTU/
ldfkzcJOtyOVAyw8w7ygHpfKHLDmbfQxmHpeisX1MKzJG5iUteNB6lbF9n0r2a6x
JfQHnAgOIb3WtiyxAqLrQhL58Be0sn5gi1OzpxPsCOm5qegi5quuiUOTcmQKIKvh
udIMQy8+u7jih6xEJSMTfzFN3I3HbAS0GFDp8vx3Xf2HRtJ+zU+QC+aYXwJfzj/6
ow0GgUa/htKpYefNuMCfGHbjLh9JIj0h1vnQaDDWMBcXo43zqPIgTTq0OKZc9p/r
I3BS2FgQDXA+FfEI5LANWOQpQLpeVQRv7rTSoLflfelOkK9ilm+Vq78FyP5oRi4d
E0QZOFhtjQ01G6bmXM+7
=2lBD
-----END PGP SIGNATURE-----


More information about the wp-hackers mailing list