Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Wordpress plugin sub menu issue

Posted on 2015-01-19
1
Medium Priority
?
94 Views
Last Modified: 2015-02-27
Hi,

I'm creating a wordpress plugin and I'm stuck on something that I just can't figure out.

I have the following method which creates the plugin menu.

function nl_create_menu() {
    add_menu_page('National Locums Timesheets','Timesheets','administrator',__FILE__,'nl_ts_admin');
    add_submenu_page(__FILE__, 'National Locums Timesheet Import','Import','administrator',__FILE__.'&act=nl_ts_import','nl_ts_import');
}

Open in new window


I then have two methods define to handle each link;

function nl_ts_import() {
    echo 'import';

    // Include view
    include_once __NL_TIMESHEET_PLUGIN_PATH . 'view/admin_import.view.php';
}

function nl_ts_admin() {
    echo 'Admin index';
}

Open in new window


The problem I'm having is that clicking the Import link in the sub menu doesn't load the 'nl_ts_import' function, it's called the nl_ts_admin function instead.

I'm sure it's a really simple thing to fix, but I cannot figure out where I'm going wrong.
0
Comment
Question by:SheppardDigital
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
SheppardDigital earned 0 total points
ID: 40635076
I managed to resolve this my changing the code that created the link.

function nl_create_menu() {
    add_menu_page('National Locums Timesheets','Timesheets','administrator',__FILE__,'nl_ts_admin2');
    add_submenu_page(__FILE__, 'National Locums Timesheet Import','Import','administrator',__FILE__.'_nl_ts_import','nl_ts_import');
    add_submenu_page(__FILE__, 'National Locums Discipline Targets','Discipline Targets','administrator',__FILE__.'_nl_ts_targets','nl_ts_targets');
    add_submenu_page(__FILE__, 'National Locums Discipline Months','Months','administrator',__FILE__.'_nl_ts_months','nl_ts_months');
    add_submenu_page(__FILE__, 'National Locums Discipline Data Editor','Data Editor','administrator',__FILE__.'_nl_ts_data_editor','nl_ts_data_editor');
}

Open in new window

0

Featured Post

Understanding Web Applications

Without even knowing it, most of us are using web applications on a daily basis. Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We often confuse these web applications tools for websites.  So, what is the difference?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

WordPress has made it easy to create scalable sites based on their powerful CMS, but as great as WordPress is, there are some SEO issues that haven’t been addressed out of the box.  Fortunately these problems can be solved with a few plugins.  The f…
WordPress can be pretty daunting, especially for a beginner, so I thought it might be a good idea to write an article to show how easy it is to get started in WordPress and to design a custom theme.  The first step is to check with your hosting comp…
The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be IPage.com Log into your Hosting account. IPage will be used for demonstration : Locat…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question