Title: Help on Admin menu creation
Last modified: August 19, 2016

---

# Help on Admin menu creation

 *  [Lopo Lencastre de Almeida](https://wordpress.org/support/users/ipublicis/)
 * (@ipublicis)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/help-on-admin-menu-creation/)
 * Hi there!
 * Can anyone give me an hint on how this function is not working?
 * `public function registerOptionsPage() {
    if ( is_callable( array( $this, 'options_page'))){
   if( !empty( $this->_selfMainMenu ) && is_callable( array( $this, 'about_page'))){
   $this->menuHook = $this->_slug . '-home'; if(function_exists(add_object_page)){
   add_object_page( $this->_pageTitle, $this->_menuTitle, $this->_accessLevel, $
   this->menuHook , array( $this, 'about_page' ), plugin_dir_url( __FILE__ ) . '/'.
   $this->_appIconFile ); } else { add_menu_page ( $this->_pageTitle, $this->_menuTitle,
   $this->_accessLevel, $this->menuHook , array( $this, 'about_page' ), plugin_dir_url(
   __FILE__ ) . '/' . $this->_appIconFile ); } add_submenu_page( $this->menuHook,
   $this->_pageTitle . ' - Overview', 'Options', $this->_accessLevel, $this->menuHook.'-
   page', array( $this, 'options_page' ) ); add_submenu_page( $this->menuHook, '
   About ' . $this->_pageTitle, 'About', $this->_accessLevel, $this->menuHook . '-
   hire', array( $this, 'about_page' ) ); } else { add_submenu_page( $this->menuHook,
   $this->_pageTitle . ' - Overview', $this->_menuTitle, $this->_accessLevel, $this-
   >_hook, array( $this, 'options_page' ) ); // Default } }
 * The variables are defined as follow:
 * ` $this->_hook = 'myPlugin';
    $this->_file = plugin_basename( __FILE__ ); $this-
   >_pluginDir = str_replace(basename( __FILE__),"",plugin_basename(__FILE__)); 
   $this->_slug = 'my-plugin-demo'; $this->_appIconFile = 'demo.ico'; $this->_selfMainMenu
   = 'My Plugin Demo'; $this->_menuHook = $this->PARENT_MENU_USERS; $this->_pageTitle
   = __( 'My Plugin Demo', $this->_slug ); $this->_menuTitle = __( 'Plugin Demo',
   $this->_slug );
 * If I don’t define `$this->_selfMainMenu` it works and depending on what I put
   in `$this->_menuHook` it creates the sub-menu.
 * I even took part of the code from WooThemes but it doesn’t work so I must be 
   doing something real silly 🙁
 * Can anyone shad a light on this? Thanks in advance!

The topic ‘Help on Admin menu creation’ is closed to new replies.

 * 0 replies
 * 1 participant
 * Last reply from: [Lopo Lencastre de Almeida](https://wordpress.org/support/users/ipublicis/)
 * Last activity: [16 years, 3 months ago](https://wordpress.org/support/topic/help-on-admin-menu-creation/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
