Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

To use jQuery UI accordion, I need markup like

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


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

...

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
add comment

1 Answer

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:

register_sidebar(array(
  '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
add comment

Your Answer

 
discard

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.