add_help_tab example

/** WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';

if ( ! current_user_can( 'export_others_personal_data' ) ) {
    wp_die( __( 'Sorry, you are not allowed to export personal data on this site.' ) );
}

// Used in the HTML title tag. $title = __( 'Export Personal Data' );

// Contextual help - choose Help on the top right of admin panel to preview this. get_current_screen()->add_help_tab(
    array(
        'id'      => 'overview',
        'title'   => __( 'Overview' ),
        'content' =>
                    '<p>' . __( 'This screen is where you manage requests for an export of personal data.' ) . '</p>' .
                    '<p>' . __( 'Privacy Laws around the world require businesses and online services to provide an export of some of the data they collect about an individual, and to deliver that export on request. The rights those laws enshrine are sometimes called the "Right of Data Portability". It allows individuals to obtain and reuse their personal data for their own purposes across different services. It allows them to move, copy or transfer personal data easily from one IT environment to another.' ) . '</p>' .
                    '<p>' . __( 'The tool associates data stored in WordPress with a supplied email address, including profile data and comments.' ) . '</p>' .
                    '<p><strong>' . __( 'Note: Since this tool only gathers data from WordPress and participating plugins, you may need to do more to comply with export requests. For example, you should also send the requester some of the data collected from or stored with the 3rd party services your organization uses.' ) . '</strong></p>',
    )
);

 else {
    // Get the extension of the file.     if ( preg_match( '/\.([^.]+)$/', $real_file$matches ) ) {
        $ext = strtolower( $matches[1] );
        // If extension is not in the acceptable list, skip it.         if ( ! in_array( $ext$editable_extensions, true ) ) {
            wp_die( sprintf( '<p>%s</p>', __( 'Files of this type are not editable.' ) ) );
        }
    }
}

get_current_screen()->add_help_tab(
    array(
        'id'      => 'overview',
        'title'   => __( 'Overview' ),
        'content' =>
                '<p>' . __( 'You can use the plugin file editor to make changes to any of your plugins&#8217; individual PHP files. Be aware that if you make changes, plugins updates will overwrite your customizations.' ) . '</p>' .
                '<p>' . __( 'Choose a plugin to edit from the dropdown menu and click the Select button. Click once on any file name to load it in the editor, and make your changes. Do not forget to save your changes (Update File) when you are finished.' ) . '</p>' .
                '<p>' . __( 'The documentation menu below the editor lists the PHP functions recognized in the plugin file. Clicking Look Up takes you to a web page about that particular function.' ) . '</p>' .
                '<p id="editor-keyboard-trap-help-1">' . __( 'When using a keyboard to navigate:' ) . '</p>' .
                '<ul>' .
                '<li id="editor-keyboard-trap-help-2">' . __( 'In the editing area, the Tab key enters a tab character.' ) . '</li>' .
                '<li id="editor-keyboard-trap-help-3">' . __( 'To move away from this area, press the Esc key followed by the Tab key.' ) . '</li>' .
                


/** Load WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';

if ( ! current_user_can( 'manage_sites' ) ) {
    wp_die( __( 'Sorry, you are not allowed to edit this site.' ) );
}

get_current_screen()->add_help_tab( get_site_screen_help_tab_args() );
get_current_screen()->set_help_sidebar( get_site_screen_help_sidebar_content() );

$id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0;

if ( ! $id ) {
    wp_die( __( 'Invalid site ID.' ) );
}

$details = get_site( $id );
if ( ! $details ) {
    wp_die( __( 'The requested site does not exist.' ) );
}
add_screen_option(
    'layout_columns',
    array(
        'max'     => 2,
        'default' => 2,
    )
);

if ( 'post' === $post_type ) {
    $customize_display = '<p>' . __( 'The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes using drag and drop. You can also minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.' ) . '</p>';

    get_current_screen()->add_help_tab(
        array(
            'id'      => 'customize-display',
            'title'   => __( 'Customizing This Display' ),
            'content' => $customize_display,
        )
    );

    $title_and_editor  = '<p>' . __( '<strong>Title</strong> &mdash; Enter a title for your post. After you enter a title, you&#8217;ll see the permalink below, which you can edit.' ) . '</p>';
    $title_and_editor .= '<p>' . __( '<strong>Post editor</strong> &mdash; Enter the text for your post. There are two modes of editing: Visual and Text. Choose the mode by clicking on the appropriate tab.' ) . '</p>';
    $title_and_editor .= '<p>' . __( 'Visual mode gives you an editor that is similar to a word processor. Click the Toolbar Toggle button to get a second row of controls.' ) . '</p>';
    $title_and_editor .= '<p>' . __( 'The Text mode allows you to enter HTML along with your post text. Note that &lt;p&gt; and &lt;br&gt; tags are converted to line breaks when switching to the Text editor to make it less cluttered. When you type, a single line break can be used instead of typing &lt;br&gt;, and two line breaks instead of paragraph tags. The line breaks are converted back to tags automatically.' ) . '</p>';
    
if ( $this->admin_header_callback ) {
            add_action( "admin_head-{$page}", $this->admin_header_callback, 51 );
        }
    }

    /** * Sets up the enqueue for the CSS & JavaScript files. * * @since 3.0.0 */
    public function admin_load() {
        get_current_screen()->add_help_tab(
            array(
                'id'      => 'overview',
                'title'   => __( 'Overview' ),
                'content' =>
                    '<p>' . __( 'You can customize the look of your site without touching any of your theme&#8217;s code by using a custom background. Your background can be an image or a color.' ) . '</p>' .
                    '<p>' . __( 'To use a background image, simply upload it or choose an image that has already been uploaded to your Media Library by clicking the &#8220;Choose Image&#8221; button. You can display a single instance of your image, or tile it to fill the screen. You can have your background fixed in place, so your site content moves on top of it, or you can have it scroll with your site.' ) . '</p>' .
                    '<p>' . __( 'You can also choose a background color by clicking the Select Color button and either typing in a legitimate HTML hex value, e.g. &#8220;#ff0000&#8221; for red, or by choosing a color using the color picker.' ) . '</p>' .
                    '<p>' . __( 'Do not forget to click on the Save Changes button when you are finished.' ) . '</p>',
            )
        );

        
if ( is_multisite() ) {
    $help .= '<p>' . __( 'Because this is a multisite installation, you may add accounts that already exist on the Network by specifying a username or email, and defining a role. For more options, such as specifying a password, you have to be a Network Administrator and use the hover link under an existing user&#8217;s name to Edit the user profile under Network Admin > All Users.' ) . '</p>' .
    '<p>' . __( 'New users will receive an email letting them know they&#8217;ve been added as a user for your site. This email will also contain their password. Check the box if you do not want the user to receive a welcome email.' ) . '</p>';
} else {
    $help .= '<p>' . __( 'New users are automatically assigned a password, which they can change after logging in. You can view or edit the assigned password by clicking the Show Password button. The username cannot be changed once the user has been added.' ) . '</p>' .

    '<p>' . __( 'By default, new users will receive an email letting them know they&#8217;ve been added as a user for your site. This email will also contain a password reset link. Uncheck the box if you do not want to send the new user a welcome email.' ) . '</p>';
}

$help .= '<p>' . __( 'Remember to click the Add New User button at the bottom of this screen when you are finished.' ) . '</p>';

get_current_screen()->add_help_tab(
    array(
        'id'      => 'overview',
        'title'   => __( 'Overview' ),
        'content' => $help,
    )
);

get_current_screen()->add_help_tab(
    array(
        'id'      => 'user-roles',
        'title'   => __( 'User Roles' ),
        
wp_enqueue_script( 'heartbeat' );

if ( 'wp_block' === $post_type ) {
    wp_enqueue_script( 'wp-list-reusable-blocks' );
    wp_enqueue_style( 'wp-list-reusable-blocks' );
}

// Used in the HTML title tag. $title = $post_type_object->labels->name;

if ( 'post' === $post_type ) {
    get_current_screen()->add_help_tab(
        array(
            'id'      => 'overview',
            'title'   => __( 'Overview' ),
            'content' =>
                    '<p>' . __( 'This screen provides access to all of your posts. You can customize the display of this screen to suit your workflow.' ) . '</p>',
        )
    );
    get_current_screen()->add_help_tab(
        array(
            'id'      => 'screen-content',
            'title'   => __( 'Screen Content' ),
            
exit;
} elseif ( ! empty( $_GET['dismiss'] ) && 'new_network_admin_email' === $_GET['dismiss'] ) {
    check_admin_referer( 'dismiss_new_network_admin_email' );
    delete_site_option( 'network_admin_hash' );
    delete_site_option( 'new_admin_email' );
    wp_redirect( network_admin_url( 'settings.php?updated=true' ) );
    exit;
}

add_action( 'admin_head', 'network_settings_add_js' );

get_current_screen()->add_help_tab(
    array(
        'id'      => 'overview',
        'title'   => __( 'Overview' ),
        'content' =>
            '<p>' . __( 'This screen sets and changes options for the network as a whole. The first site is the main site in the network and network options are pulled from that original site&#8217;s options.' ) . '</p>' .
            '<p>' . __( 'Operational settings has fields for the network&#8217;s name and admin email.' ) . '</p>' .
            '<p>' . __( 'Registration settings can disable/enable public signups. If you let others sign up for a site, install spam plugins. Spaces, not commas, should separate names banned as sites for this network.' ) . '</p>' .
            '<p>' . __( 'New site settings are defaults applied when a new site is created in the network. These include welcome email for when a new site or user account is registered, and what&#8127;s put in the first post, page, comment, comment author, and comment URL.' ) . '</p>' .
            '<p>' . __( 'Upload settings control the size of the uploaded files and the amount of available upload space for each site. You can change the default value for specific sites when you edit a particular site. Allowed file types are also listed (space separated only).' ) . '</p>' .
            '<p>' . __( 'You can set the language, and WordPress will automatically download and install the translation files (available if your filesystem is writable).' ) . '</p>' .
            '<p>' . __( 'Menu setting enables/disables the plugin menus from appearing for non super admins, so that only super admins, not site admins, have access to activate plugins.' ) . '</p>' .
            
wp_redirect( admin_url( 'erase-personal-data.php' ), 301 );
        exit;
    }
}

/** WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';

// Used in the HTML title tag. $title = __( 'Tools' );

get_current_screen()->add_help_tab(
    array(
        'id'      => 'converter',
        'title'   => __( 'Categories and Tags Converter' ),
        'content' => '<p>' . __( 'Categories have hierarchy, meaning that you can nest sub-categories. Tags do not have hierarchy and cannot be nested. Sometimes people start out using one on their posts, then later realize that the other would work better for their content.' ) . '</p>' .
        '<p>' . __( 'The Categories and Tags Converter link on this screen will take you to the Import screen, where that Converter is one of the plugins you can install. Once that plugin is installed, the Activate Plugin &amp; Run Importer link will take you to a screen where you can choose to convert tags into categories or vice versa.' ) . '</p>',
    )
);

get_current_screen()->set_help_sidebar(
    '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    '<p>' . __( '<a href="https://wordpress.org/documentation/article/tools-screen/">Documentation on Tools</a>' ) . '</p>' .
    
add_filter(
    'admin_body_class',
    static function( $body_class ) {
        $body_class .= ' privacy-settings ';

        return $body_class;
    }
);

$action = isset( $_POST['action'] ) ? $_POST['action'] : '';

get_current_screen()->add_help_tab(
    array(
        'id'      => 'overview',
        'title'   => __( 'Overview' ),
        'content' =>
                '<p>' . __( 'The Privacy screen lets you either build a new privacy-policy page or choose one you already have to show.' ) . '</p>' .
                '<p>' . __( 'This screen includes suggestions to help you write your own privacy policy. However, it is your responsibility to use these resources correctly, to provide the information required by your privacy policy, and to keep this information current and accurate.' ) . '</p>',
    )
);

get_current_screen()->set_help_sidebar(
    '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    
/** Load WordPress Bootstrap */
require_once __DIR__ . '/admin.php';

if ( ! current_user_can( 'import' ) ) {
    wp_die( __( 'Sorry, you are not allowed to import content into this site.' ) );
}

// Used in the HTML title tag. $title = __( 'Import' );

get_current_screen()->add_help_tab(
    array(
        'id'      => 'overview',
        'title'   => __( 'Overview' ),
        'content' => '<p>' . __( 'This screen lists links to plugins to import data from blogging/content management platforms. Choose the platform you want to import from, and click Install Now when you are prompted in the popup window. If your platform is not listed, click the link to search the plugin directory for other importer plugins to see if there is one for your platform.' ) . '</p>' .
            '<p>' . __( 'In previous versions of WordPress, all importers were built-in. They have been turned into plugins since most people only use them once or infrequently.' ) . '</p>',
    )
);

get_current_screen()->set_help_sidebar(
    '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    '<p>' . __( '<a href="https://wordpress.org/documentation/article/tools-import-screen/">Documentation on Import</a>' ) . '</p>' .
    
/** WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';

if ( ! current_user_can( 'manage_options' ) ) {
    wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
}

// Used in the HTML title tag. $title       = __( 'Permalink Settings' );
$parent_file = 'options-general.php';

get_current_screen()->add_help_tab(
    array(
        'id'      => 'overview',
        'title'   => __( 'Overview' ),
        'content' => '<p>' . __( 'Permalinks are the permanent URLs to your individual pages and blog posts, as well as your category and tag archives. A permalink is the web address used to link to your content. The URL to each post should be permanent, and never change &#8212; hence the name permalink.' ) . '</p>' .
            '<p>' . __( 'This screen allows you to choose your permalink structure. You can choose from common settings or create custom URL structures.' ) . '</p>' .
            '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>',
    )
);

get_current_screen()->add_help_tab(
    array(
        

}

/** * Fires early before the Widgets administration screen loads, * after scripts are enqueued. * * @since 2.2.0 */
do_action( 'sidebar_admin_setup' );

get_current_screen()->add_help_tab(
    array(
        'id'      => 'overview',
        'title'   => __( 'Overview' ),
        'content' =>
                '<p>' . __( 'Widgets are independent sections of content that can be placed into any widgetized area provided by your theme (commonly called sidebars). To populate your sidebars/widget areas with individual widgets, drag and drop the title bars into the desired area. By default, only the first widget area is expanded. To populate additional widget areas, click on their title bars to expand them.' ) . '</p> <p>' . __( 'The Available Widgets section contains all the widgets you can choose from. Once you drag a widget into a sidebar, it will open to allow you to configure its settings. When you are happy with the widget settings, click the Save button and the widget will go live on your site. If you click Delete, it will remove the widget.' ) . '</p>',
    )
);
get_current_screen()->add_help_tab(
    array(
        'id'      => 'removing-reusing',
        
'default_contextual_help',
                array( '' ),
                '3.3.0',
                'get_current_screen()->add_help_tab(), get_current_screen()->remove_help_tab()'
            );
            if ( $default_help ) {
                $old_help = '<p>' . $default_help . '</p>';
            }
        }

        if ( $old_help ) {
            $this->add_help_tab(
                array(
                    'id'      => 'old-contextual-help',
                    'title'   => __( 'Overview' ),
                    'content' => $old_help,
                )
            );
        }

        $help_sidebar = $this->get_help_sidebar();

        $help_class = 'hidden';
        
$media_options_help = '<p>' . __( 'You can set maximum sizes for images inserted into your written content; you can also insert an image as Full Size.' ) . '</p>';

if ( ! is_multisite()
    && ( get_option( 'upload_url_path' )
        || get_option( 'upload_path' ) && 'wp-content/uploads' !== get_option( 'upload_path' ) )
) {
    $media_options_help .= '<p>' . __( 'Uploading Files allows you to choose the folder and path for storing your uploaded files.' ) . '</p>';
}

$media_options_help .= '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>';

get_current_screen()->add_help_tab(
    array(
        'id'      => 'overview',
        'title'   => __( 'Overview' ),
        'content' => $media_options_help,
    )
);

get_current_screen()->set_help_sidebar(
    '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    '<p>' . __( '<a href="https://wordpress.org/documentation/article/settings-media-screen/">Documentation on Media Settings</a>' ) . '</p>' .
    '<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>'
);
Home | Imprint | This part of the site doesn't use cookies.