1
0
Fork 0
mirror of https://github.com/inretio/WordPress-Plugin-Boilerplate synced 2024-12-22 20:03:53 +02:00

Added Plugin Settings page (commented out)

Added a Plugin Settings page, that can be enabled by uncommenting the line that hooks it into the admin_menu action hook.

Added additional views that contain the WordPress standard markup to wrap the plugin settings markup.

The views are now loaded into the plugin page.
This commit is contained in:
Mikkel Breum 2013-04-07 23:05:13 +02:00
parent 403ef654ea
commit fd69c019ec
3 changed files with 28 additions and 0 deletions

View file

@ -41,6 +41,10 @@ class PluginName {
// Load plugin text domain // Load plugin text domain
add_action( 'init', array( $this, 'plugin_textdomain' ) ); add_action( 'init', array( $this, 'plugin_textdomain' ) );
// Add the options page and menu item
// Uncomment the following line to enable the Settings Page for the plugin
# add_action('admin_menu', array( $this, 'plugin_admin_menu' ) );
// Register admin styles and scripts // Register admin styles and scripts
add_action( 'admin_enqueue_scripts', array( $this, 'register_admin_styles' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'register_admin_styles' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'register_admin_scripts' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'register_admin_scripts' ) );
@ -148,6 +152,26 @@ class PluginName {
} // end register_plugin_scripts } // end register_plugin_scripts
function plugin_admin_menu() {
// TODO: Change 'Page Title' to the title of your plugin admin page
// TODO: Change 'Menu Text' to the text for menu item for the plugin settings page
// TODO: Change 'plugin-name' to the name of your plugin
$this->plugin_screen_slug = add_plugins_page('Page Title', 'Menu Text', 'read', 'plugin-name', array( $this, 'plugin_admin_page' ));
} // end plugin_admin_menu
function plugin_admin_page() {
// output the cpanel
include_once('views/admin_open.php');
include_once('views/admin.php'); // outputs the settings/form markup for the plugin admin markup
include_once('views/admin_close.php');
} // end plugin_admin_page
/*--------------------------------------------* /*--------------------------------------------*
* Core Functions * Core Functions
*---------------------------------------------*/ *---------------------------------------------*/

View file

@ -0,0 +1 @@
</div><!-- .wrap -->

View file

@ -0,0 +1,3 @@
<div class="wrap">
<?php screen_icon(); ?>
<h2>My Plugin Name</h2>