What is the use case for the “Class” parameter in register_sidebar?

If you fill class parameter to register_sidebar function then the class sidebar-{class name} gets added to the div of that sidebar in the back end. For example if you register the sidebar using following code : register_sidebar( array( ‘name’ => __(‘Footer Widget One’, ‘wpbs-framework’), ‘id’ => ‘footer-01’, ‘class’ => ‘testing’, ‘description’ => __(‘The first footer … Read more

Which settings/options are saved on a theme-basis and how does this affect theme-switching?

After doing some research this answer became a bit longer than expected, but this is the essence: TL;DR: Menu placement and Widget placement/order is saved on a Theme basis and can therefore be restored when switching Themes. This does not include the individual settings of Menus and Widgets, so if you change them these changes … Read more

Unregistering a Sidebar in Child Theme

It should be possible to use the after_setup_theme hook to unregister the sidebar you don’t want like this: function go_away_extra_sidebar(){ unregister_sidebar( ‘Footer’ ); } add_action( ‘after_setup_theme’, ‘go_away_extra_sidebar’ ); Happy Coding, Kuchenundkakao

use add_action(‘wp_head’) in a widget for generating dynamic CSS styles

Once the widgets are being evaluated, the head of your site is completed, so you cannot use wp_head anymore. Adding <style> tags is an option, but will indeed generate a warning from the validator. Using the customizer is possibly confusing, because it is supposed to be about theme looks in general, not about specific widgets. … Read more

Check if widget has content

Problem solved by this code below: <?php if (is_active_sidebar(‘extra_widget_1’)) { ?> <li> <?php dynamic_sidebar(‘extra_widget_1’); ?> </li> <?php } ?>

remove the wrapping of text widget or

More than likely this is an issue with the register_sidebar() call in functions.php. Look for before_widget and after_widget. The code below is the default usage. ‘before_widget’ => ‘<li id=”%1$s” class=”widget %2$s”>’, ‘after_widget’ => ‘</li>’, Note: This will alter all of the widgets within the sidebar, not just the TextWidget.

Difference between widget form code variables

$this is the widget object, an instance of the relevant widget class. It includes things like the widget ID and class identifiers which are required for the method that generate the input id and name attribute in the snippet $instance is the array which includes the widget setting. The settings ae not stored as part … Read more

Widgets vs. Theme Mods

In short: It depends. Widget go into a widget area. But that also means that when you create a widget area any widget can be put there as well as any number of widgets. So if you’d make the logo a widget a user could put twenty different widgets in that spot, including stuff that … Read more