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.

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

So my HTML looks like this:

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

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.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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

<?php
register_sidebar(array('name'=>'custom-content',
 '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; ?>
</div>
share|improve this answer
    
Thank you a lot, you were very helpful. It worked fine with little modifications. –  kidwon Sep 20 '11 at 19:12

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.