Skip to content
stianjensen edited this page Jul 19, 2012 · 4 revisions

Creates an administration page.

Minimal example:

<?php

class Example_Admin_Page extends scbAdminPage {

	function setup() {
		$this->args = array(
			'page_title' => 'scb Example',
		);
	}

	function page_content() {
		echo html( 'p', 'Hello World!' );
	}
}

To instantiate the class, you would do something like this:

<?php
function _scb_example_init() {
	if ( is_admin() ) {
		new Example_Admin_Page( __FILE__ );
	}
}
scb_init( '_scb_example_init' );

Parameters

These are the parameters that scbAdminPage takes:

  • $page_title (string) (mandatory)
  • $parent (string) (default: options-general.php)
  • $capability (string) (default: 'manage_options')
  • $menu_title (string) (default: $page_title)
  • $page_slug (string) (default: sanitized $page_title)
  • $toplevel (string) If not empty, will create a new top level menu (for expected values see http://codex.wordpress.org/Administration_Menus#Using_add_submenu_page)
  • $icon_url (string) URL to an icon for the top level menu
  • $position (int) Position of the toplevel menu (caution!)
  • $screen_icon (string) The icon type to use in the screen header
  • $nonce string (default: $page_slug)
  • $action_link (string|bool) Text of the action link on the Plugins page (default: 'Settings')
  • $admin_action_priority (int) The priority that the admin_menu action should be executed at (default: 10)_
Clone this wiki locally