• I have a simple site help menu on the admin page. My plugin is site specific but while I can show the menu links the function calls dont work.
    Only sub menu 1 is shown whatever subpage link selected.
    Can any one help please.
    My code is

    <?php
    /*
    Plugin Name: Help
    Description: Adds a site help link to the admin menu
    Author: Mike Stocks
    */
    //define constant plugin file name
    global $wpdb, $wp_version;
    define ('siteHelp',basename(__FILE__));
    
    // mt_add_pages() is the sink function for the 'admin_menu' hook
    function add_help_pages()
    {
        // Add a new top-level menu:
       // The first parameter is the Page name(Site Help), second is the Menu name(Help)
       //and the number(5) is the user level that gets access
        add_menu_page('siteHelp', 'Site Help', 2, 'siteHelp', 'mt_toplevel_page');
        add_submenu_page('siteHelp','Site Help','Authors-General',2,'__FILE__','submenu_1');
        add_submenu_page('siteHelp','Site Help','Authors-Marketing',2,'__FILE__','submenu_2');
        add_submenu_page('siteHelp','Site Help','Authors-Edit',2,'__FILE__','submenu_3');
    
    }
    
    // mt_toplevel_page() displays the page content for the custom Test Toplevel menu
    function mt_toplevel_page() {
        echo '
        <div class="wrap">
          <h2>Site Help</h2>
          <p>This page contains information and tutorials that are specific to your site.
          If you have trouble with anything on this page contact Mike Stocks of
          <a href="https://hawkesleypublishingsolutions.com">Hawkesley Publishing Solutions</a> by sending an email using the reference"[email protected]"
    
          <h3>Video Tutorials</h3>
          <p>Please note that these tutorials require a Flash Player, available to
          <a href="https://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
          download for free from Adobe</a>.</p>
          <ul>
            <li><a href="/wp-content/uploads/filename.swf">How to edit existing pages</a></li>
            <li><a href="/wp-content/uploads/filename.swf">How to create a new page or post</a></li>
          </ul>
        </div>
        ';
        exit;
    }
    function submenu_1(){
    				echo "submenu 1";
    				exit();
    }
    function submenu_2(){
    				echo "submenu 2";
    				exit;
    }
    function submenu_3(){
      				echo "submenu 3";
      				exit;
    }
    // Insert the add_help_pages() sink into the plugin hook list for 'admin_menu'
    add_action('admin_menu', 'add_help_pages');
    ?>

  • The topic ‘plugin admin menu sub pages malfunction’ is closed to new replies.