Tip: add a widget anywhere with the_widget()

March 10, 2010 | 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.

Share This Blog Post

  • email
  • Twitter
  • Tumblr
  • FriendFeed
  • Facebook
  • Digg
  • del.icio.us
  • Blogosphere News
  • StumbleUpon
  • Google Bookmarks
  • Ping.fm
  • HelloTxt
  • Mixx

Related Posts

Tags: , , , , , ,

Leave a Reply

CommentLuv Enabled
Download WordPress
WordPress Philippines
  • China Wholesale