WordPress Background Add Sidebar menu

Source: Internet
Author: User
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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.