I have a sidebar called footer, I know I can use dynamic_sidebar() but I need to be able to split that into individual widgets.
I have the following so far which gives me the widget name e.g. text-1, category-2 etc but I am after the content for each of those.
$widget_list= get_option('sidebars_widgets');
if($widget_list)
foreach($widget_list["footer"] as $widget){
var_dump($widget);
}
Is this possible to get the widget content from the widget name?
The registered widgets in your
sidebar-1
might beIf you got for example the
calendar-2
widget, then from:you will get something like:
You can therefore try this modified version of
dynamic_sidebar()
to call a widget that you have placed in a given sidebar:where you call it like this:
Another way would be to try to use the
the_widget()
function, where you would have to know the widget’s class name.