Below is the code snippet. But when I call it the top menu is repeated twice it also repeats itself in the submenu.
if (!class_exists("ex")) {
class ex {
function ex() { //constructor
}
function Main() { echo "test"; }
function ConfigureMenu() { add_menu_page("Ex", "ex", "manage_options", 's_ex', array('ex','Main')); add_submenu_page( 's_ex', 'ex < Post', 'Post', "manage_options", 's1_ex', array('ex','Main')); }
}
}
//Create new instance of class if (class_exists("ex")) { $c_ex = new ex(); }
//Actions and Filters if(isset($c_ex)){
// Administration Actions add_action('admin_menu', array($c_ex,'ConfigureMenu')); }