Tip: add a widget anywhere with the_widget()

| February 28, 2011 | Leave a Comment

Here’s a very useful tip for everyone comfortable with customizing their WordPress themes: you can add any widget anywhere on your site, not just in your sidebar or widgetized areas, using the template tag the_widget.

Here’s the syntax:

<?php the_widget($widget, $instance, $args); ?>

This post by Shailan explains how to find the widget class name and arguments to use in the code. Refer to the Codex for the names of the default widgets. Want to create your own widget? Valums shows you how.

Related Posts

Tags: , , , , , ,

Leave a Reply