This article mainly introduces the WordPress background add sidebar menu, has a certain reference value, now share to everyone, have the need for friends can refer to
Add_action (' Admin_menu ', ' register_custom_menu_page '); function Register_custom_menu_page () { add_menu_page (' custom menu title ', ' Test menu ', ' Administrator ', ' show_ads/view.php ', ' ' , Plugins_url (' Myplugin/images/icon.png '), 6); }
Add a file under the folder where your plugin is used as a new menu page, view.php
Add_menu_page ($page _title, $menu _title, $capability, $menu _slug, $function, $icon _url, $position);
$page _title: (String) (must) This parameter is a submenu of the title, will be displayed in the browser's title bar, default is empty;
$menu _title: (String) (must) display the menu name, default is empty;
$capability: (String) (must) User rights, define what permissions users will see this submenu (Permission section see the end of the article), default is empty, refer to capability;
$menu _slug: (String) (must) display the menu name above the URL, default is empty;
$function: The method name returned;
$icon _url: (string) (optional) Display the menu icon, you can use Plugin_dir_url (__file__), the icon width is 16 pixels high;
$position: (integer) (optional) Displays the location of the menu. Common Position, 4 or 59 or 99.
The above is the whole content of this article, I hope that everyone's learning has helped, more relevant content please pay attention to topic.alibabacloud.com!