How to get individual values from custom widget?

I think you’re doing this the hard way. I would first visit phpMyAdmin, find your WP database, find the Options table, and then search the option_name field for the name of your widget using the %search_term% form. When you find it you’ll see all the data behind the widget stored in a single field/string called … Read more

Inserting a class on before_widget if checkbox is checked

I eventually use the following to be able to do it: add_filter(‘dynamic_sidebar_params’, function($params) { global $wp_registered_widgets; $this_widget_id = $params[0][‘widget_id’]; $this_widget = $wp_registered_widgets[$this_widget_id]; $widget_object = $this_widget[‘callback’][0]; $all_settings = get_option($widget_object->option_name); $saved_settings = $all_settings[$params[1][‘number’]]; if ($saved_settings[‘myclass’]) { $classe_to_add = ‘myclass ‘; $classe_to_add = ‘class=” ‘.$classe_to_add; $params[0][‘before_widget’] = str_replace(‘class=”‘,$classe_to_add,$params[0][‘before_widget’]); } return $params; });