wp_lib_dash_page_ - roberts-sandbox/create-repo GitHub Wiki
###Description
This action hook allows developers to add their own Library Dashboard page or overwrite a default page with their own.
Call this hook with the name of the Dash page you want to create/overwrite, so if you wanted to overwrite the View Items page with your own custom page then you'd use the hook wp_lib_dash_page_view-items.
###Context
To access the Library Dashboard users must be at the minimum a librarian and thus logged in as a WordPress user.
###Parameters
$ajax_page
The instance of WP-Librarian's Dashboard page loading class WP_LIB_AJAX_PAGE. Access to this is necessary to render the Dashboard page when finished, or call an error if one occurs.
###Example
If you wanted to add a custom Dash page at the URL my-dash-page, that displays two paragraphs, you could use the following code:
add_filter('wp_lib_dash_page_my-dash-page', 'add_my_dash_page');
function add_my_dash_page($page_name, WP_LIB_AJAX_PAGE $ajax_page) {
// Each element of this array is rendered as a Dash page element
$page_content = array(
array(
'type' => 'paras',
'content' => array(
'My First Plugin',
'WordPress is magic'
)
)
);
// This appears as an HTML header at the top of the Dash page
$page_title = 'My Dashboard Page';
// This forms part of the browser tab's name, it's generally a good idea to keep this short
$tab_title = 'My Dash Page';
// Renders page as JSON then stops execution, sending the result to JavaScript on the Dashboard
$ajax_page->sendPage($page_title, $tab_title, $page_content);
}
This would create the following Dash page:

The browser tab's title would appear as 'My Dash Page ‹ Site Name', where 'Site Name' would be the name of your WordPress installation, as set in your site's General Options.
###See Also
wp_lib_dash_page wp_lib_dash_action wp_lib_dash_action_ wp_lib_dash_api wp_lib_dash_api_