How to add the widgets manually to the sidebar?

Have a look at the the_widget() function. The first argument is required. It is the PHP class name of the widget. For example:

<div class="sidebar">
  <?php the_widget('WP_Widget_Search') ?>
</div>

You can also pass on extra arguments:

<div class="sidebar">
  <?php the_widget('WP_Widget_Text', 'title=Hello&text=World') ?>
</div>

Leave a Comment