Advertisement
TBotNik

EM Submenu test

Nov 16th, 2011
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. <?php
  2. /***************************************************************************/
  3. /* Plugin Name: WPS Poll */
  4. /* URI: ../wp-content/plugins/wps-poll */
  5. /* Description: This plugin is a test plugin for learning purpose. */
  6. /* Version: 0.1 Author: Nyle Davis */
  7. /* Author URI: http://URI_Of_The_Plugin_Author */
  8. /* License: GPL2 - most WordPress plugins are released under GPL2 */
  9. /***************************************************************************/
  10.  
  11. function wps_poll_options_page () {
  12. ?>
  13. <div class=”wrap”>
  14. <h2>WPS Poll Admin</h2>
  15. <p>Here comes the options page content.</p>
  16. </div>
  17. <?php
  18. }
  19.  
  20. function wps_poll_new_page () {
  21. ?>
  22. <div class=”wrap”>
  23. <h2>WPS Poll New Page</h2>
  24. <p>Here is the new page contents.</p>
  25. </div>
  26. <?php
  27. }
  28.  
  29. function wps_poll_menu () {
  30. // Works
  31. add_menu_page('WPS Poll', __('WPS Poll'),'manage_options',basename(__FILE__), 'wps_poll_options_page');
  32.  
  33. $parent_slug = 'wps-poll.php';
  34. $page_title = 'WPS Poll';
  35. $menu_title = 'WPS Poll';
  36. $capability = 'manage_options';
  37. $menu_slug = basename(__FILE__);
  38. $function = 'wps_poll_new_page';
  39. // Doesn't Work
  40. //add_submenu_page($parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function);
  41. // Test writing a submenu to Events manger
  42. // Doesn't Work
  43. $parent_slug = ABSPATH.'/wp-content/plugins/events-manager/events-manager.php';
  44. add_submenu_page($parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function);
  45. }
  46.  
  47. add_action('admin_menu','wps_poll_menu');
  48.  
  49. ?>
  50.  
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement