I have been reading through the WordPress Source, trying to get a better understanding of how dynamic sidebars are rendered.
However, I am hitting a sticking point…
894 | do_action( 'dynamic_sidebar', $wp_registered_widgets[$id] );
I can’t find where add_action(‘dynamic_sidebar’, … ) is defined. Without out that part, I am sort of lost in what happens.
See the code here:
And to give more context, I am trying to figure out how to grab an array of widgets, and then from there, how would you render each one.
I need finer control than dynamic_sidebar(...);
gives me
That action is just there in case a plugin or theme wants to do something before sidebars are rendered. The code you’re looking for is in
widgets.php
, just before and just after that action:In the wp_register_sidebar_widget() function, you can see where
$wp_registered_widgets[$id]
gets set to an array of information about the widget, including the display/output callback: