Removing custom widget area WordPress 4.4 [closed]
Removing custom widget area WordPress 4.4 [closed]
Removing custom widget area WordPress 4.4 [closed]
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
I don’t see anything wrong with the widget class. The problem you have is that you are displaying the widget area, that contains the widgets, twice in your sidebar.php: <aside id=”secondary” class=”widget-area col-sm-12 col-md-12 col-lg-12″ role=”complementary”> <div class=”col-lg-6 col-md-12″> <?php dynamic_sidebar( ‘main-widget’ ); // this will display all the widgets in your main-widget sidebar ?> … Read more
There’s a extension called “Widget Logic”. It adds a field to every sidebar widget in admin section where you can add a piece of php code that you can use to archive what you most likely need. Its a bit cumbersome but works. For example you mention that for multilanguage site, you can still use … Read more
To some degree, the answer depends on the intended use of the sidebar menu, but in general, it is best to allow the greatest degree of freedom to the end user. If the intended use of the sidebar menu is to be, well, a navigation menu, then I would strongly recommend supporting the core Nav … Read more
I managed to solve this myself. Instead of using register_sidebars() to register the sidebars all together, I simply used the singular register_sidebar() in a for loop, so that it registered a sidebar for every matching page. All one would need to do to get this working is change the template name (in my case template-generic-sidebar) … Read more
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
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
Widget area inside a widget
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