- Create a sidebar
$type . '_sidebar'
- Register the sidebar
$type . '_sidebar'
(e.gdog_sidebar
) - Pass the type as GET argument to the widget.php (create some menu entries or something else where you link to e.g.
wp-admin/widgets.php?sidebar_type=dog_sidebar
) -
Filter out every sidebar that should not be displayed. You can use this function:
global $wp_registered_sidebars; $type =filter_input( INPUT_GET, 'sidebar_type', FILTER_SANITIZE_STRIPPED ); if ( empty( $type ) ) return; if ( isset( $wp_registered_sidebars[ $type ] ) ) { $keep = array( $type => $wp_registered_sidebars[ $type ] ); $wp_registered_sidebars = array_intersect_key( $keep, $wp_registered_sidebars ); } } add_action( 'sidebar_admin_setup', 'filter_sidebars', 1, 0 );
For example in Twenty Twelve there are three registered sidebars (the sidebar IDs): sidebar-1, sidebar-2 and sidebar-3.
If you now go to your-blogdoma.in/wp-admin/widgets.php?sidebar_type=sidebar-3
, there is only the third sidebar left (with ID sidebar-3
).
If you have registered a sidebar dog_sidebar
and visit your-blogdoma.in/wp-admin/widgets.php?sidebar_type=dog_sidebar
, the only visible sidebar is the ‘Dog Sidebar’ (with ID dog_sidebar
).
The plugin stores data for the sidebar based on the “type”‘s id
There is no need to do this. Every sidebar stores it’s own data. But maybe I misunderstood what you attempting with “stores data for the sidebar“.