[wp-hackers] Sidebar widget HTML/DOM
otto at ottodestruct.com
Thu Jun 24 15:36:19 UTC 2010
On Thu, Jun 24, 2010 at 9:38 AM, [ ravi ] <ravi-lists at g8o.net> wrote:
> FYI, the jQuery hack I have is to first use ‘before_title’ to add an <h2> element with class=‘widgettitle’ to each element that has a title. This gives me something like this in the sidebar (using the Pages widget as an example):
> <div class=‘widget ….’ ….>
> <h2 class=‘widgettitle’ ….>Pages</h2>
> <li> … page1 … </li>
> <li> … page2 … </li>
> Since I want to wrap the UL (in this example) in a DIV so I can style it (make it collapsible, actually, in my case), here’s what I do in jQuery:
> jQuery(this).nextAll().wrapAll('<div class="widgetcontent" />’);
> This works for me, for now, but it would still be nice to be able to wrap it explicitly/deterministically in PHP, so if anyone has any ideas, including filters/actions that would accomplish this on the server end, please do let me know.
Why do you need to wrap it in a div? It's directly addressable with
jQuery(".widget ul") if you want to do it that way.
More information about the wp-hackers