WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

To use jQuery UI accordion, I need markup like

<h3>Module 1</h3>
   <!-- module content here -->

<h3>Module 2</h3>
   <!-- module content here -->


How can I setup my side bar like that? Or perhaps I somehow change the way jQuery creates accordian, maybe there are some options?

share|improve this question
up vote 1 down vote accepted

When you register your sidebar, you can change how it handles those things with the before_title, after_title, before_widget, and after_widget arguments. For example:

  'before_widget' => '',
  'before_title' => '<h3>',
  'after_title' => "</h3>\n<div>",
  'after_widget' => '</div>'

Would make all of the widgets in that sidebar have that structure. You could also add classes to the tags defined there (<h3 class="accordion-toggle">, </h3>\n<div class='accordion-content'>). Just make sure all your widgets have a title; otherwise the widget will cause some tag imbalance.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.