php - How to have more than one "Theme Options" page with OptionTree? -
optiontree (github) allows create "theme options" page themes simply.
how extend optiontree in order create "plugin options" page plugin?
thank you!
it's pretty simple. following code create page under settings page called test page. how optiontree creates own pages.
/** * hook register admin pages */ add_action( 'init', 'register_options_pages' ); /** * registers required admin pages. */ function register_options_pages() { // execute in admin & if ot installed if ( is_admin() && function_exists( 'ot_register_settings' ) ) { // register pages ot_register_settings( array( array( 'id' => 'custom_options', 'pages' => array( array( 'id' => 'test_page', 'parent_slug' => 'options-general.php', 'page_title' => 'test page', 'menu_title' => 'test page', 'capability' => 'edit_theme_options', 'menu_slug' => 'test-page', 'icon_url' => null, 'position' => null, 'updated_message' => 'test page updated.', 'reset_message' => 'test page reset.', 'button_text' => 'save changes', 'show_buttons' => true, 'screen_icon' => 'options-general', 'contextual_help' => null, 'sections' => array( array( 'id' => 'test_section', 'title' => __( 'test section', 'motif-core' ) ) ), 'settings' => array( array( 'id' => 'test_section_input', 'label' => 'test input', 'desc' => 'pretty freaking awesome!', 'std' => '', 'type' => 'text', 'section' => 'test_section', 'class' => '' ) ) ) ) ) ) ); } }
Comments
Post a Comment