Categories
Programming

WordPress – add_help_tab – add context help to custom admin plugin page

How to add context help to custom admin plugin page? Some time ago I had to put help content to custom admin plugin page for my project.

context_help

There are pretty good examples at wordpress.org . Here is one of those examples :

<?php 
add_action('admin_menu', 'my_admin_add_page');

function my_admin_add_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 () {
    $screen = get_current_screen();

    // 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>',
    ) );
}
?>

This is working fine if you want to add context help to your custom option page within settings menu or to your custom post type. But if you have empty admin page then probably will nothing happened like in my case. Why is that?

Categories
Programming

PHP : __FILE__ problem with symbolics links and file path

Some time ago I have organized my wordpress plugins via symbolic links. It’s helped me to keep all plugins inside one repository dir and eases me to deploy plugins in different test wordpress locations on my WAMP server. Example of that organization :


d:\plugins\plugin1 // real loaction
d:\plugins\plugin2 // real location
...
d:\www\wordpress\wp-content\plugins\plugin1 // symbolic link
d:\www\wordpress\wp-content\plugins\plugin2 // symbolic link
...