Admin Shell Integration #
New in v1.2.0
Extensions can add new top-level sections to the Admin Shell Column 1 and new views to any section’s Column 2 using two filters provided by Core.
Adding a Top-Level Section (Column 1) #
Use the dmsilm_admin_shell_sections filter to register a new section:
add_filter( 'dmsilm_admin_shell_sections', function( $sections ) {
$sections[] = array(
'slug' => 'my-extension',
'label' => 'My Extension',
'icon' => 'dashicons-admin-plugins',
'full_width' => false,
'order' => 50,
);
return $sections;
} );
Parameters:
| Key | Type | Description |
|---|---|---|
slug | string | Unique identifier used in URL parameter (§ion=my-extension) |
label | string | Display name shown in Column 1 |
icon | string | Dashicons CSS class for the icon |
full_width | bool | Set true if the section has no sub-views; hides Column 2 |
order | int | Sort order in Column 1 (core sections use 10-40; use 50+ for extensions) |
Adding Views to a Section (Column 2) #
Use the dmsilm_admin_shell_pages filter to register views within a section. Include the section key in each page array to specify which section the view belongs to:
add_filter( 'dmsilm_admin_shell_pages', function( $pages ) {
$pages[] = array(
'section' => 'my-extension',
'slug' => 'overview',
'label' => 'Overview',
'callback' => array( 'My_Extension_Overview_Handler', 'render' ),
'priority' => 100,
'capability' => 'manage_options',
'source' => 'extension',
);
$pages[] = array(
'section' => 'my-extension',
'slug' => 'config',
'label' => 'Configuration',
'callback' => array( 'My_Extension_Config_Handler', 'render' ),
'priority' => 101,
'capability' => 'manage_options',
'source' => 'extension',
);
return $pages;
} );
Parameters:
| Key | Type | Description |
|---|---|---|
section | string | Slug of the section this view belongs to; must match a registered section slug (required) |
slug | string | Unique view identifier used in URL parameter (&view=overview) |
label | string | Display name shown in Column 2 |
callback | callable | Callable that renders Column 3 content; typically array( ClassName::class, 'method_name' ) (required) |
priority | int | Sort order within the section’s Column 2 list; core uses 10–80, extensions should use 100+ |
capability | string | WordPress capability required to view this page; defaults to manage_options |
source | string | Set to 'extension' for extension-added pages; adds a visual divider between core and extension pages in Column 2 |
Handler Callable Requirements #
The callable provided in callback must be loadable before the shell calls it. A typical pattern is a public static method:
class My_Extension_Overview_Handler {
public static function render() {
echo '<div class="wrap">';
echo '<h1>My Extension Overview</h1>';
// your content here
echo '</div>';
}
}
The callback value can be any PHP callable: a static class method array, an instance method array, a closure, or a global function name. The shell calls it with no arguments.
Full-Width Sections #
If your section has no sub-views, set 'full_width' => true when registering it. Core will apply the dmsilm-shell-wrap--full-width CSS class, hiding Column 2 and giving Column 3 the full available width.
Building URLs Programmatically #
Use DMSILM_Admin_Shell_Router::build_url( $section, $view ) to generate correct admin shell URLs from your extension code:
$url = DMSILM_Admin_Shell_Router::build_url( 'my-extension', 'overview' );
This is safer than constructing the URL string manually, as it will remain correct if Core’s URL structure changes.
Related Topics #
- [The Three Columns](#)
- [Navigating the Admin](#)
- [Settings Tab Integration](#)
