Advertisement
gilzow

revised help screen

Feb 9th, 2015
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.24 KB | None | 0 0
  1. /**
  2.  * Removes the default contextual help panel tabs and adds our custom help tab.  Contents for our custom tab are assumed
  3.  * to be contained in a directory names "views" in a file named "sampleHelp.html".  Adjust as needed
  4.  *
  5.  * @param $strOldHelp string
  6.  * @param $intScreenID integer
  7.  * @param $objScreen object
  8.  * @return string
  9.  */
  10. function mizzouAdjustHelpScreen($strOldHelp,$intScreenID,$objScreen)
  11. {
  12.     // we only want to adjust the help contents when working on the default post type
  13.     if($objScreen->post_type == 'post'){
  14.         // we only want to adjust the help contents if we can load our custom help contents
  15.         if (FALSE !== $strHelpContents = file_get_contents(dirname(__FILE__).DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.'sampleHelp.html')) {
  16.  
  17.             //get rid of all the default help tabs in the contextual help panel
  18.             $objScreen->remove_help_tabs();//get rid of all the help tabs
  19.  
  20.             //remove the help panel sidebar
  21.             $objScreen->set_help_sidebar('');
  22.  
  23.             //add our custom help tab
  24.             $objScreen->add_help_tab(array(
  25.                 'id' => 'sample_help_tab',
  26.                 'title' => 'Sample Help Tab',
  27.                 'content' => $strHelpContents,
  28.             ));
  29.         }
  30.     }
  31.  
  32.     return $strOldHelp;
  33. }
  34.  
  35. add_filter('contextual_help','mizzouAdjustHelpScreen',10,3);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement