[wp-hackers] Using the_widget() to get a specific instance of a multi-instance widget

Mikel mikel at mahunneysfarm.com
Mon Aug 9 13:07:39 UTC 2010



On Sun, Aug 8, 2010 at 6:26 AM, Mikel <mikel at mahunneysfarm.com> wrote:

> Trying to use the_widget() to access a specific instance of a
> multi-instance widget and failing miserably.
> 
> Have tried by title and fiddling with variations on array(number=> x) for
> the $instance parameter but
> multiple sidebars is the only way I can get this running successfully with
> the WP Text Widget.
> 

That's because the_widget() doesn't search for a specific instance; instead,
it expects you to send it an instance yourself. It's basically a shortcut
for calling WP_Widget_Text::widget().


Thank you for your input Scribu.

Experimenting with the_widget() it is capable of retrieving a saved instance (saved by
dragging the widget to the inactive area on the widgets page).



Regards



Mikel




More information about the wp-hackers mailing list