How To Add Menu Page Into Admin

Some times we need to add new menu into WordPress administration panel. So that author can have separate page to add some more content . Developers can create a new menu item by adding some more functionality into code.

Actually it is pretty easy to create new menu by using build in function. WordPress provide us  add_new_page()  function to create new menu into WP admin.

add_menu_page(  $page_title$menu_title$capability,  $slugcallable function = ,   $icon_url = int $position = null )

Here are some required parameters such as $pagetitle, $menutitle,$slug and callable function.Callable function should contain html structure along with functionality.

 See Example:

 

/* hook is used to call this function*/

add_action('admin_menu','help_menu');
function help_menu(){
add_menu_page('Help Menu','Help Menu','admin','user-help','help_page');
}
function help_page(){
  $content .= '<h1>User Help Section</h1>';  
  $content .= 'Some more content....';
  echo $content;
}

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s