Is it possible to use widgets outside of the sidebar? When you assign them in the admin panel you have to drag them to your sidebar but I would like to implement a search function outside the sidebar. Can I do this?
A:
Absolutely. This thread in the WordPress support forums should get you going. It creates a new widget area ready called Homepage
that can then be used in any of your theme's template files:
Your theme's functions.php
if (function_exists('register_sidebar')) {
register_sidebar(array(
'name'=> 'Main',
'id' => 'main',
'before_widget' => '<div class="widget_box side">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));
register_sidebar(array(
'name'=> 'Homepage',
'id' => 'homepage',
'before_widget' => '<div class="widget_box">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));
}
The template file you want the Homepage widget in
<?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('Homepage')) : ?>
Alternatively, you can use the My Custom Widgets plugin to do the same thing.
Pat
2010-09-09 11:50:56