-
Notifications
You must be signed in to change notification settings - Fork 16
Help Overview
Within the Ah-O2 plugin we've re-used the existing WP_Screen class that already exists in the WordPress Core (it is stored in the $current_screen global). This means that any help content that already exists will automatically be displayed. Within the plugin we have full control on overwriting or adding to the existing content.
Within the WordPress-Admin-Help plugin there is the docs folder. In this folder are individual php files for admin pages based on their slugs (Ex. plugins.php is the Plugins Admin Page). You can add help content in these files. If no file exists for an admin page you can copy an existing file and rename it.
By default existing content is already defined, If you would like to remove the existing help content you will need to reset the proper variables of the $current_screen object.
$current_screen->_help_tabs = array();
$current_screen->_help_sidebar = '';
To add a new Help Section to the page you use the add_help_tab() function of the $current_screen object. This function accepts an associated array containing id, title and content.
$current_screen->add_help_tab( array(
'id' => 'New Help',
'title' => __('New Help'),
'content' => '<p>Some Help Text</p><p>More Content</p>',
) );You can add as many Help sections as desired for the page.
The _help_sidebar is a legacy property that displays additional reference links. Currently the plugin converts this content into an "Additional Resources" section of the Help Content. This is not required to be used.