duplicate sidebar

Try giving a unique ID to each dynamic sidebar, via the id parameter passed to register_sidebar(): register_sidebar( array( ‘id’ => ‘essential’, ‘name’ => __(‘Essential Plan’), ‘before_widget’ => ”, ‘after_widget’ => ”, ‘before_title’ => ”, ‘after_title’ => ” ) ); register_sidebar( array( ‘id’ => ‘premier’, ‘name’ => __(‘Premier Plan’), ‘before_widget’ => ”, ‘after_widget’ => ”, ‘before_title’ … Read more

how do I get a sidebar’s id or number for use with is_active_sidebar()

Found a solution to the problem. I added a line of code id => ‘my-sidebar-id’ to the register_sidebar array so now i know the sidebar ID. There may be another way of doing it but this method seems to work fine for me now anyway. if ( function_exists(‘register_sidebar’) ) register_sidebar(array( ‘name’ => ‘Right Sidebar’, ‘id’ … Read more

How to add multiple custom widget areas

You have to register multiple areas: function new_sidebar_widget_init() { register_sidebar( array( ‘name’ => ‘new-sidebar’, ‘id’ => ‘new-sidebar’, ‘before_widget’ => ‘<div id=”new-sidebar”>’, ‘after_widget’ => ‘</div>’, ‘before_title’ => ”, ‘after_title’ => ”, ) ); register_sidebar( array( ‘name’ => ‘new-sidebar-1’, ‘id’ => ‘new-sidebar-1’, ‘before_widget’ => ‘<div id=”new-sidebar”>’, ‘after_widget’ => ‘</div>’, ‘before_title’ => ”, ‘after_title’ => ”, ) ); … Read more

Sidebar Generator? :)

The code for this plugin is actually pretty simple. The init function loops through all the sidebars (stored in the wp_options table) and registers them in wordpress: <?php function init(){ //go through each sidebar and register it $sidebars = sidebar_generator::get_sidebars(); if(is_array($sidebars)){ foreach($sidebars as $sidebar){ $sidebar_class = sidebar_generator::name_to_class($sidebar); register_sidebar(array( ‘name’=>$sidebar, ‘before_widget’ => ‘<li id=”%1$s” class=”widget sbg_widget … Read more

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