WordPress.org

Forums

contextual_help to all edit pages (5 posts)

  1. infohowdy
    Member
    Posted 4 years ago #

    Hello, I need to add more help text when a user edit or add page/posts.
    In codex I found this http://codex.wordpress.org/Adding_Contextual_Help_to_Administration_Menus but the add_filter priority overwrite the default help...

  2. David Gard
    Member
    Posted 4 years ago #

    The below is what I use to add contextual help to the edit/new page for a post type called 'news'. All you should have to do is identify the name of the screen name of the post types (probably just 'post' and 'page') and change text to what you want.

    add_filter('contextual_help', 'help_text', 10, 3);
    function help_text($contextual_help, $screen_id, $screen){
    	switch($screen->post_type){
    		case 'news':
    			$contextual_help =
    				'<p>' . __('Things to remember when adding or editing an article:') . '</p>' .
    				'<ul>' .
    				'<li>' . __('Specify the correct news type so that the correct articles are displayed under the correct news types on the website.') . '</li>' .
    				'<li>' . __('Ensure that the text is displayed correctly by viewing or previewing the article before moving on.') . '</li>' .
    				'</ul>' .
    				'<p>' . __('If you want to schedule a article to be published in the future:') . '</p>' .
    				'<ul>' .
    				'<li>' . __('Under the Publish module, click on the Edit link next to Publish.') . '</li>' .
    				'<li>' . __('Change the date to the date to actually publish this article, then click on Ok.') . '</li>' .
    				'</ul>' .
    				'<p><strong>' . __('For more information:') . '</strong></p>' .
    				'<p>' . __('<a href="http://codex.wordpress.org/Posts_Edit_SubPanel" target="_blank">Edit Posts Documentation</a>') . '</p>' .
    				'<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' ;
    			break;
            }
    }
  3. infohowdy
    Member
    Posted 4 years ago #

    Hello duck__boy,
    thankyou for reply but the code replace the default wp help...

  4. infohowdy
    Member
    Posted 4 years ago #

    This code replace the default wp help, I need to add my code before or after...

    function my_custom_help($contextual_help, $screen_id, $screen) {
    	if ($screen_id == 'page' || $screen_id == 'post'  ) {
    		$contextual_help = '<p><b>This is my custom help text</b></p>';
    	}
    	return $contextual_help;
    }
    add_filter('contextual_help', 'my_custom_help', 10, 3);
  5. acochran
    Member
    Posted 3 years ago #

    Change one line:
    $contextual_help .= '<p><b>This is my custom help text</b></p>';

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.