Guest User

Untitled

a guest
Apr 22nd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.54 KB | None | 0 0
  1. <?php
  2.  
  3. // init action
  4. add_action('admin_menu','wm_install');
  5.  
  6. // all things that have to happen when installed
  7. function wm_install() {
  8.  
  9.     // to be used in contextual help, make an array to set a text for each theme page (but one step at a time)
  10.     global $wm_main_hook;
  11.  
  12.     // add to admin menu
  13.     $wm_main_hook = add_theme_page( 'Widget Area Manager', 'Widget Area Manager', 'administrator', 'widget_area_manager', 'wm_area_manager_admin' );
  14.    
  15.     add_theme_page( 'Edit Sidebar', 'Edit Sidebar', 'administrator', 'widget_area_editor', 'wm_area_editor_admin' );
  16.     add_theme_page( 'Edit Widget', 'Edit Widget', 'administrator', 'widget_html_editor','wm_edit_widget' );
  17.  
  18. }
  19.  
  20. // help for widget area manager
  21. function wm_help( $contextual_help, $screen_id, $screen ) {
  22.  
  23.     // to be used in contextual help
  24.     global $wm_main_hook;
  25.  
  26.     $context_help = 'DEFAULT';
  27.  
  28.     if( $screen_id == $wm_main_hook ) {
  29.  
  30.         // set the text variable used for what i want to show up here
  31.         $contextual_help = "<p>This plugin Widget Area Manager, has some limitations, because of the way sidebars are setup. Unfortunately, I had thought sidebar data was saved in the database, but it is not, just widget's are. ";
  32.         $contextual_help .= "So this means, that I can not add/remove sidebars that are saved, into the database. So I have focused this plugin on being able to edit sidebars, and edit widgets, and then add/remove widgets to sidebars.</p>";
  33.  
  34.     }
  35.  
  36.     return $contextual_help;
  37.  
  38. }
  39.  
  40. // Add the contextual help to the theme page
  41. add_filter('contextual_help', 'wm_help', 10, 3);
  42.  
  43.  
  44. ?>
Add Comment
Please, Sign In to add comment