-
Notifications
You must be signed in to change notification settings - Fork 55
scbBoxesPage
scribu edited this page Jul 2, 2011
·
1 revision
Creates an admin screen with metaboxes, similar to the dashboard screen. It's based on scbAdminPage.
Minimal example:
<?php
class Example_Boxes_Page extends scbBoxesPage {
function setup() {
$this->args = array(
'page_title' => 'scb Example Boxes',
);
$this->boxes = array(
// id, title, column
array( 'settings', 'Settings Box', 'normal' ),
array( 'right', 'Right Box', 'side' ),
);
}
function settings_box() {
echo html( 'p', 'This is the settings box.' );
}
function right_box() {
echo html( 'p', 'This is the box on the right.' );
}
}
To instantiate the class, you would do something like this:
<?php
function _scb_example_init() {
if ( is_admin() ) {
new Example_Boxes_Page( __FILE__ );
}
}
scb_init( '_scb_example_init' );
For each box, you must define a {name}_box() method, which echoes the box's content.