Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Plugin Probs

By: samuel_rogers on Jul 8th, 2013  |  syntax: None  |  size: 1.01 KB  |  views: 34  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. /** add menu. */
  3. add_action( 'admin_menu', 'my_plugin_menu', 'my_magic_function' );
  4. add_submenu_page( 'my_plugin_menu', 'Page title', 'Sub-menu title', 'manage_options', 'my-submenu-handle', 'my_magic_function');
  5.  
  6.  
  7. function my_plugin_menu() {
  8.         add_options_page( 'My Plugin Options', 'My Plugin', 'manage_options', 'my-unique-identifier', 'my_plugin_options' );
  9. }
  10.  
  11. function my_plugin_menu() {
  12.         add_options_page( 'Submenu', 'My Plugin', 'manage_options', 'my-submenu-handle', 'my_plugin_options' );
  13. }
  14.  
  15. /** html. */
  16. function my_plugin_options() {
  17.         if ( !current_user_can( 'manage_options' ) )  {
  18.                 wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
  19.         }
  20.         echo '<div class="wrap">';
  21.         echo '<p>Main page</p>';
  22.         echo '</div>';
  23. }
  24.  
  25. function my_plugin_options() {
  26.         if ( !current_user_can( 'manage_options' ) )  {
  27.                 wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
  28.         }
  29.         echo '<div class="wrap">';
  30.         echo '<p>submenu page</p>';
  31.         echo '</div>';
  32. }
  33. ?>