Why do none of my widgets have a title?

WordPress 5.8 added the ability to add Blocks to sidebars. Blocks do not use the title and markup defined for a sidebar. They just use the normal HTML they would use in the editor. “Legacy” widgets can still be added, and should still have the option to enter a title and use the markup defined … Read more

Custom sidebar not showing in the dashboard

Register sidebar. add_action( ‘widgets_init’, ‘wpse_123456_widgets_init’ ); function wpse_123456_widgets_init() { $args = array( ‘name’ => __( ‘Sidebar name’, ‘theme_text_domain’ ), ‘id’ => ‘unique-sidebar-id’, ‘description’ => ”, ‘class’ => ”, ‘before_widget’ => ‘<li id=”%1$s” class=”widget %2$s”>’, ‘after_widget’ => ‘</li>’, ‘before_title’ => ‘<h2 class=”widgettitle”>’, ‘after_title’ => ‘</h2>’ ); if ( function_exists (‘register_sidebar’)) { register_sidebar( $args ); } } … Read more

Hooking Into Widget Output Loop

Hook into ‘dynamic_sidebar’ and count how often it is called. You get the current active sidebar with key( $GLOBALS[‘wp_registered_sidebars’] ). add_action( ‘dynamic_sidebar’, ‘wpse_96681_hr’ ); function wpse_96681_hr( $widget ) { static $counter = 0; // right sidebar in Twenty Ten. Adjust to your needs. if ( ‘primary-widget-area’ !== key( $GLOBALS[‘wp_registered_sidebars’] ) ) return; if ( 0 … Read more

is_active_sidebar() not working

Try this in your functions.php function your_widget(){ register_sidebar(array( ‘name’ => ‘Footer Column 2’, ‘id’ => ‘footer-column-2’, // I also added the ID but doesn’t work ‘before_widget’ => ‘<div id=”%1$s” class=”omc-footer-widget %2$s”>’, ‘after_widget’ => ‘</div>’, ‘before_title’ => ‘<h4>’, ‘after_title’ => ‘</h4>’ )); } add_action( ‘widgets_init’, ‘your_widget’ ); Call in footer.php with the ID. <?php if ( … Read more

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