Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

How can i change the content of the help section for all of my admin pages?

I've removed a lot of the admin that won't be used, but i want to add information to the help section for the additional pages. Like the add new page for all my custom post types and different pages that are used in the plugins i'm using. So i can explain how to do things on the specific pages.

What's the best way to do this?

Thanks

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You can add this code in your functions.php file.

function example_contextual_help( $contextual_help, $screen_id, $screen ) {
    //echo 'Screen ID = '.$screen_id.'<br />';
    switch( $screen_id ) {
        case 'my_plugin_page_1' :
            $contextual_help .= '<p>';
            $contextual_help = __( 'Your text here.' );
            $contextual_help .= '</p>';
            break;
        case 'my_plugin_page_2' :
            $contextual_help .= '<p>';
            $contextual_help = __( 'Your text here.' );
            $contextual_help .= '</p>';
            break;
    }
    return $contextual_help;
}
add_filter('contextual_help', 'example_contextual_help', 10, 3);

To get the screen_id of the particular page, just uncomment the first line in the above function and check your plugin page's contextual help. Then add the screen id to the switch case like 'my_plugin_page_1'. Incase your plugin is a single page plugin (or few pages) then you could just do a if condition (any one would do) instead of the switch cases in the following manner.

if ( $screen_id == 'my_plugin_page' ) {
   $contextual_help .= '<p>';
   $contextual_help = __( 'Your text here.' );
   $contextual_help .= '</p>';
}
return $contextual_help;
share|improve this answer
    
Is this the simplest way? Is there no plugin or something. With this can i edit the help of all the pages i want to. How do i differentiate between each page? Is it based on what you put for case 'my_plugin_page_1' –  Corbula Nov 30 '11 at 17:17
    
Yup sorry I forgot to mention that.... I'll edit the answer so that it is more clear to you. –  Joshua Abenazer Nov 30 '11 at 17:23
    
Does the above answer solve your issue? Or you still stuck? –  Joshua Abenazer Nov 30 '11 at 18:33
    
I think it does, but i've only quickly tested it. I think it should be ok but i won't mark it as the right answer just yet, until i've done more just in case i need some more help. I will accept it soon though if it goes ok. –  Corbula Nov 30 '11 at 20:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.