Читать книгу Professional WordPress Plugin Development - Brad Williams - Страница 89

Creating the Plugin Administration Page

Оглавление

The plugin page will be located at Settings ➪ PDev Settings:

<?php // Add a menu for our option page add_action( 'admin_menu', 'pdev_plugin_add_settings_menu' ); function pdev_plugin_add_settings_menu() { add_options_page( 'PDEV Plugin Settings', 'PDEV Settings', 'manage_options', 'pdev_plugin', 'pdev_plugin_option_page' ); } // Create the option page function pdev_plugin_option_page() { ?> <div class="wrap"> <h2>My plugin</h2> <form action="options.php" method="post"> </form> </div> <?php } ?>

This page is empty for now. You will add form inputs later. Creating pages for plugins is covered in detail earlier in the “Plugin Settings” section of this chapter, so refer to it for more explanation about this code.

Professional WordPress Plugin Development

Подняться наверх