post

Adding Contextual Help Tab to Edit/Add New Post/Page

It is fairly simple and straightforward on how to add contextual help tabs to various admin pages, and with the imminent advent of Genesis 1.8, adding contextual help will be as simple as a help() method. There are also a wide variety of great tutorials on how to add contextual help to admin pages, such as Justin Tadlock’s Adding contextual help to plugin and theme admin pages.

However, there aren’t any tutorials (at least that I could find) on how to add contextual help to edit/add-new post pages. So while I believe this may not be the best way to do this, it works! Being a pragmatist, it works for me!

// Add contextual help
add_action( 'add_meta_boxes' , 'wps_help' , 10 , 2 );
function wps_help ( $post_type , $post ) {
	if ( 'page' == $post_type ) {
		$my_help_tab_content = '<p>' . __( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam varius iaculis dui, eu ultricies velit consectetur pellentesque. Phasellus tortor mi, tempor eget pulvinar eu, sollicitudin ut eros. Quisque fermentum dolor elit. Aenean varius nisi placerat lectus elementum fringilla. Aenean at augue mauris, eu euismod mauris. Integer ac eros in ligula pharetra pretium. Pellentesque vel orci nibh. Pellentesque gravida velit ac lacus egestas eget imperdiet metus egestas. Maecenas tellus ligula, molestie ac pharetra id, tristique eu velit. Phasellus id quam in mi tristique gravida eget in quam. Cras ornare leo sed dui lobortis congue.') . '</p>';

		get_current_screen()->add_help_tab( array(
			'id'      => 'my-help-id',
			'title'   => __( 'My Help Tab' ),
			'content' => $my_help_tab_content,
		) );
	}
}
About Travis Smith

As a WordPress Enthusiast, Travis writes about his journey in WordPress trying to help other WordPress travelers and enthusiasts with tutorials, explanations, & demonstrations of the things he learns.

Comments

  1. Great tip Travis. This actually comes at the perfect time for me because I had couple users asking how to do this on the tutorial I wrote on the subject. One thing you should note, however, is that this does not work in any version less than 3.3.

  2. Thank you very much, Mr. Travis. I had been around find nothing that can help me create help tab for my custom post admin page, but your article help me so much. ^_^.
    Before I found your post, I did hack on wp-admin/edit.php

Leave a Reply

%d bloggers like this: