Does anyone know how to create multiple admin widget pages with calling specific sidebars?
In Detail,
I have a custom post type called Groups and I am creating new admin pages in the back end.
I added a submenu to Groups called Widgets. I created a sidebar for Groups and I want to add this sidebar to the Groups widget page.
So, it is just like usual admin widget page but with only one sidebar.
So far,
$post_type = $_REQUEST['post_type'];
$retrieved_widgets = retrieve_widgets();
foreach ($retrieved_widgets as $key => $value) {
if ( $key !== "groups-sidebar" ) {
unset($retrieved_widgets[$key]);
}
}
$wp_registered_sidebars = $retrieved_widgets;
//print_r($wp_registered_sidebars);
require_once(ABSPATH . 'wp-admin/widgets.php');
This code adds only the groups sidebar to the Groups Widget page. But I have some errors such as
Notice: Undefined index: class in D:\wp-admin\widgets.php on line 369
So I am guessing something is missing or not configured properly.