In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article is about how to add top-level menus and submenus in the WordPress background. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Add Settings Page-add_menu_page function
Add_menu_page (), this function is to add the top-level menu to the background, that is, the same top-level menu as "appearance", "plug-in" and so on.
The function is described as follows:
For the function parameter, this parameter is usually the function name. If you want to call the method of the class, call it in the form of array (class name, function name). If this parameter is empty, the menu_slug parameter can be a file path.
For the position parameter of the above function, the default menu item location attribute is as follows:
2 Dashboard 4 Separator 5 Posts 10 Media 15 Links 20 Pages 25 Comments 59 Separator 60 Appearance 65 Plugins 70 Users 75 Tools 80 Settings 99 Separator
All right, let's explain it with an example. Only in this way can Li Jufu. Create a new myfuntions.php in the default Twenty Ten theme, and then include opens our myfunctions.php with an editor in the functions.php file
Add a new code:
As you can see, the menu position is 6. By comparison, you can find that it will be at the back of the article. Look:
A top-level menu page has already appeared.
Add submenu item-add_submenu_page
The function to add a submenu item is as follows:
In fact, with the first two tutorials, there is no need to say much about the use of this function.
Example, use the files from the previous two tutorials (create a new myfuntions.php in the default Twenty Ten theme, and then include the new file in the functions.php file) open our myfunctions.php with an editor. We have added a top-level menu item in the previous tutorial, and today we will add a submenu item based on this top-level menu item to keep yesterday's code Add the new code, and then the code in myfunctions.php looks like this:
The effect is as follows:
OK, add submenu items to complete.
Thank you for reading! This is the end of the article on "how to add top-level menus and submenus in the WordPress background". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.