In the plugin I am developing I am using the following code to build my menu -
add_menu_page('BCRM Plugin Settings', 'BCRM',
'administrator', __FILE__, 'bcrm_settings_page', BOOGIE__PLUGIN_URL .
'_inc/img/icon_settings.png');
add_submenu_page( __FILE__, 'BCRM Customer Settings', 'Customer Settings',
'administrator', 'BCRM', 'bcrm_customer_settings_page');
add_submenu_page( __FILE__, 'BCRM Form Settings', 'Form Settings',
'administrator', 'BCRM', 'bcrm_form_settings_page');
My functions are built like this -
function bcrm_settings_page() {
if ( !current_user_can( 'manage_options' ) ) {
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
}
require_once( BOOGIE__PLUGIN_DIR . 'views/options.php' );
}
function bcrm_customer_settings_page() {
if ( !current_user_can( 'manage_options' ) ) {
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
}
require_once( BOOGIE__PLUGIN_DIR . 'views/customer_settings.php' );
}
function bcrm_form_settings_page() {
if ( !current_user_can( 'manage_options' ) ) {
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
}
require_once( BOOGIE__PLUGIN_DIR . 'views/form_settings.php' );
}
When ever I view the contents of these menus, they look to be loading my views twice. So if I click on Customer Settings, I get the content of both views loading like this -
Customer Relations Management This is the customers page.
Customer Relations Management This is the forms page.
What am I doing that is causing my two views to load on every page?