Hey guys I'm trying to activate a sidebar for wp widgets.

So my HTML looks like this:

<aside id="leftSidebar">
      <div class="contents"></div>

So I want to put the widget inside "contents" and its title in h3 tag. How my activate function should be and what php to put in my html if needed? I didn't find any examples near mine so I appreciate any help 10x a lot in advance.

1 Answer 1


You would register the sidebar in the functions.php file with something like this:

 'before_widget' => '<section>',
 'after_widget' => "</section>",
 'before_title' => '<h3>',
 'after_title' => "</h3>"

And Use it in your theme like this:

<div class="contents">
<?php if ( function_exists(dynamic_sidebar(1) ) ) : ?>
    <?php dynamic_sidebar(custom-content); ?>
<?php endif; ?>
  • Thank you a lot, you were very helpful. It worked fine with little modifications.
    – kidwon
    Sep 20, 2011 at 19:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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