You can display the specified widget using the_widget
. It takes the class name of the widget as an argument (not ID), so you’ll need to know that info to use it, but this allows you to use a widget outside the sidebar.
If you’re looking to run some code based on the presence of a plugin, you want to use is_active_widget
, which does take the ID as a parameter.
foreach( $widgets_list as $item ) {
if ( is_active_widget( false, false, $item, true ) ) {
//do your thing
}
}