I think the the_widget()
function is meant to act as kind of a replacement for the dynamic widgets; so dragging and dropping them has nothing to do with using the_widget()
.
In the case of the Text Widget, the “instance” argument is basically looking for an array of “title” (the title you want to appear at the top of the widget), “text” (I believe this is where the content of the widget goes) and “filter” (looking at the source for the text_widget, it looks like this is a boolean indicating whether to apply wpautop()
to the content or not).
Therefore, you would use something along the lines of:
<?php
$mywidgettext = '<p>This is the text of my widget. This should appear where it\'s called';
the_widget('WP_Widget_Text',array('My Text Widget',$mywidgettext));
?>
to display the widget wherever you wanted it.
Since you want to be able to easily modify the content of the widget without having to modify theme files, you could conceivably put the content of the widget in a separate file, then pull it in as a variable into your theme.
That might look something like (assuming your widget content is stored in a file called “mytextwidget.php” in the root of your WordPress installation):
<?php
$mywidgettext = file_get_contents( ABSPATH . 'mytextwidget.php' );
the_widget('WP_Widget_Text',array('My Text Widget',$mywidgettext));
?>