Support » Requests and Feedback » get_dynamic_sidebar function needed or perhaps a hook?
6 years, 5 months ago
Widgets are great to give the user control over what goes in a sidebar.
However in the case of plugins sometimes we need to get the code and control how/when its echo’d out.
Therefore it would be great to have get_dynamic_sidebar that returns the string.
The alternative would be a hook that is called after the user leaves the loop (somehow). The idea is that the plugin can run without requiring the user to update their templates. The benefits are
6 years, 4 months ago
Meanwhile it is developed in the core, I have found this one in the trunk, you can use it 😉
function get_dynamic_sidebar($index = 1)
$sidebar_contents = “”;
$sidebar_contents = ob_get_clean();
5 years, 5 months ago
@_dorsvenabili That worked for me =) Do you remember the link to where you found it? It definitely seems like it would be useful to have it as an official function.
Ah found it, for anyone else looking, see: core.trac.wordpress.org/ticket/13169