how do I get_sidebar into a varaible?

You probably need to use output buffering, if I understand your question correctly. Try something like this: ob_start(); dynamic_sidebar(‘sidebar-id’); $sidebar = ob_get_contents(); ob_end_clean(); That will put the output of the sidebar into the variable $sidebar, which you can then process and return from your filter on the page content.

How to edit contents of dynamic_sidebar()?

The contents of dynamic_sidebar are pulled from the widgets associated with this “Sidebar” aka “Widget Area” in wp-admin, as @s_ha_dum answered. There is no template file for the sidebar itself. Visit /wp-admin/widgets.php under Appearance -> Widgets and find the widget area titled homepage-infobox. You be able to add/remove widgets and possibly make changes to the … Read more

Retrieve each widget separately from a sidebar

I am taking the core of the question to be: “… I’m not able to retrieve the widget class name” You will need to check the global variable $wp_registered_widgets to fill in the missing information. This proof-of-concept code should give you the idea. The code assumes a sidebar named sidebar-1. You will have to adjust … Read more

Sharing Dynamic Sidebars across Multisite Blogs

Unfortunately, the switch_to_blog() method isn’t going to work for this purpose. switch_to_blog() is really only a partial switch – it makes some modifications to $wpdb that help with database queries. But it’s not a complete switch in the way you might imagine. In particular, dynamic_sidebar() depends on global called $wp_registered_sidebars. This global is populated by … Read more

Get number of widgets in sidebar

After some research and based on the answer from Eugene Manuilov I made a function that adds custom classes to widgets in a specific sidebar (‘sidebar-bottom’ in my case) based on the number of widgets set in that sidebar. This will suit perfectly in horizontal sidebars and themes based on twitter bootstrap that need spanX … Read more

Where is the content of widgets stored in mysql table

Widget options are stored in the options table under ‘sidebars_widgets’ as a serialized array. See this post for a longer explanation. Changing the field per PHPMyAdmin is not recommended, use PHP, get_option() and update_option() instead, WordPress will take care for correct serialization then.