Creating a multi-level administration menu
When plugins grow in complexity, their configuration options often grow in numbers, giving users a high level of flexibility in choosing how the plugin behaves on their site. While it is possible to display all the plugin options on a single lengthy configuration page, creating a new top-level menu item with multiple sections can help organize parameters in logical groupings that will allow users to find what they are looking for more quickly. It also has the side benefit of making your plugin appear more prominently in the WordPress administration menu.
How to do it...
Follow these steps to create a new top-level menu item in the administration menu with an accompanying submenu item:
- Navigate to the WordPress
plugins
directory of your development installation. - Create a new directory called
ch3-multi-level-menu
. - Navigate to this directory and create a new text file called
ch3-multi-level-menu.php
. - Open the new file...