Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created January 20, 2012 22:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/1650052 to your computer and use it in GitHub Desktop.
Save billerickson/1650052 to your computer and use it in GitHub Desktop.
Admin Pages - Setup class
<?php
/**
* Child Theme Settings
* Requires Genesis 1.8 or later
*
* This file registers all of this child theme's specific Theme Settings, accessible from
* Genesis > Child Theme Settings.
*
* @package BE Genesis Child
* @author Bill Erickson <bill@billerickson.net>
* @copyright Copyright (c) 2011, Bill Erickson
* @license http://www.opensource.org/licenses/gpl-license.php GPL v2.0 (or later)
* @link https://github.com/billerickson/BE-Genesis-Child
*/
/**
* Registers a new admin page, providing content and corresponding menu item
* for the Child Theme Settings page.
*
* @package BE Genesis Child
* @subpackage Admin
*
* @since 1.0.0
*/
class Child_Theme_Settings extends Genesis_Admin_Boxes {
/**
* Create an admin menu item and settings page.
*
* @since 1.0.0
*/
function __construct() {
// Specify a unique page ID.
$page_id = 'child';
// Set it as a child to genesis, and define the menu and page titles
$menu_ops = array(
'submenu' => array(
'parent_slug' => 'genesis',
'page_title' => 'Genesis - Child Theme Settings',
'menu_title' => 'Child Theme Settings',
)
);
// Set up page options. These are optional, so only uncomment if you want to change the defaults
$page_ops = array(
// 'screen_icon' => 'options-general',
// 'save_button_text' => 'Save Settings',
// 'reset_button_text' => 'Reset Settings',
// 'save_notice_text' => 'Settings saved.',
// 'reset_notice_text' => 'Settings reset.',
);
// Give it a unique settings field.
// You'll access them from genesis_get_option( 'option_name', 'child-settings' );
$settings_field = 'child-settings';
// Set the default values
$default_settings = array(
'phone' => '',
'address' => '',
);
// Create the Admin Page
$this->create( $page_id, $menu_ops, $page_ops, $settings_field, $default_settings );
// Initialize the Sanitization Filter
add_action( 'genesis_settings_sanitizer_init', array( $this, 'sanitization_filters' ) );
}
function sanitization_filters() {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment