WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Class Reference/WP Screen/set help sidebar

This page is marked as incomplete. You can help Codex by expanding it.

Contents

Description

This function is used to add a sidebar to the Contextual Help menu in an admin page. The sidebar appears to the right-side of the main help content.

set_help_sidebar() is a method of the WP_Screen class, and can not be called directly.

Sidebar must be registered AFTER help tabs have been added using the add_help_tab() method.

Usage

<?php
$screen 
get_current_screen();
$screen->set_help_sidebar$content );
?>

Parameters

$content
(string) (optional) Help sidebar content in plain text or HTML.
Default: None

Example

<?php 

   add_action('admin_menu', 'my_admin_add_page');

   function my_admin_add_page() {

       global $my_admin_page;

       $my_admin_page = add_options_page(__('My Admin Page', 'map'), __('My Admin Page', 'map'), 'manage_options', 'map', 'my_admin_page');


       // Adds my_help_tab when my_admin_page loads
       add_action('load-'.$my_admin_page, 'my_admin_add_help_tab');

   }

   function my_admin_add_help_tab () {

    global $my_admin_page;

    $screen = get_current_screen();

    /*
     * Check if current screen is My Admin Page
     * Don't add help tab if it's not
     */
    if ( $screen->id != $my_admin_page )
        return;

    // Add my_help_tab if current screen is My Admin Page
    $screen->add_help_tab( array(
        'id'	=> 'my_help_tab',
        'title'	=> __('My Help Tab'),
        'content'	=> '<p>' . __( 'Descriptive content that will show in My Help Tab-body goes here.' ) . '</p>',
    ) );

    $screen->set_help_sidebar(
                              __('This is the content you will be adding to the sidebar for the current page. You must make sure other tabs have already been added using the "add_help_tab" function above. This sidebar will not show up unless there are tabs for the current screen')
                             );
    }
?>

Change Log

Source File

set_help_sidebar() is located in wp-admin/includes/screen.php.

Related

Topics

Functions

Resources