コード例 #1
0
<?php

$create_multitabs_option_page = array('parent_slug' => 'options-general.php', 'page_title' => __('Multitab Option Page', 'text_domain'), 'menu_title' => __('Multitab Option Page', 'text_domain'), 'capability' => 'manage_options', 'menu_slug' => 'multitabs_menu', 'option_name' => 'multitabs_options', 'tabs' => array('general' => array('name' => __('General'), 'fields' => array(array('id' => 'text', 'type' => 'text', 'name' => __('Text Example', 'text_domain'), 'desc' => __('Description for text', 'text_domain'), 'std' => __('Default Value', 'text_domain')), array('id' => 'email', 'type' => 'email', 'name' => __('Email Example', 'text_domain'), 'desc' => __('Description for email', 'text_domain'), 'std' => get_option('admin_email')), array('id' => 'url', 'type' => 'url', 'name' => __('URL Example', 'text_domain'), 'desc' => __('Description for url', 'text_domain'), 'std' => site_url()), array('id' => 'number', 'type' => 'number', 'name' => __('Number Example', 'text_domain'), 'desc' => '', 'std' => 123456789))), 'color_date' => array('name' => __('Color & Date'), 'fields' => array(array('id' => 'color', 'type' => 'color', 'name' => __('Color Picker Example', 'text_domain'), 'std' => '#ffffff'), array('id' => 'date', 'type' => 'date', 'name' => __('Date Picker Example', 'text_domain'), 'std' => date("m/d/Y", time())))), 'radio_select' => array('name' => __('Radio & Select'), 'fields' => array(array('id' => 'radio', 'type' => 'radio', 'name' => __('Radio Example', 'text_domain'), 'std' => 'choice_two', 'options' => array('choice_one' => 'Choice One', 'choice_two' => 'Choice Two', 'choice_three' => 'Choice Three', 'choice_four' => 'Choice Four')), array('id' => 'select', 'type' => 'select', 'name' => __('Select Example', 'text_domain'), 'std' => 'choice_three', 'options' => array('choice_one' => 'Choice One', 'choice_two' => 'Choice Two', 'choice_three' => 'Choice Three', 'choice_four' => 'Choice Four')))), 'textarea' => array('name' => __('Textarea'), 'fields' => array(array('id' => 'textarea', 'type' => 'textarea', 'name' => __('Textarea Example', 'text_domain'), 'desc' => __('This textarea does not declare any validation method. You cannot add any HTML tag here.', 'text_domain'), 'std' => __('Default Value', 'text_domain')), array('id' => 'textarea2', 'type' => 'textarea', 'name' => __('Textarea Example', 'text_domain'), 'desc' => __('This textarea declare a validation method "inlinehtml". It can content inline HTML tags like a, img, span', 'text_domain'), 'validate' => 'inlinehtml'))), 'file_uploader' => array('name' => __('File Uploder'), 'fields' => array(array('id' => 'file', 'type' => 'file', 'name' => __('File Uplode Example', 'text_domain'), 'btn_browse' => __('Browse File', 'text_domain'), 'btn_insert' => __('Insert Into Page', 'text_domain'), 'multiple' => true))), 'checkbox' => array('name' => __('Checkbox'), 'fields' => array(array('id' => 'checkbox', 'type' => 'checkbox', 'name' => __('Checkbox Example', 'text_domain'), 'std' => 1))), 'wp_editor' => array('name' => __('Editor'), 'fields' => array(array('id' => 'wp_editor', 'type' => 'wp_editor', 'name' => __('Editor Example', 'text_domain'), 'desc' => __('This textarea declare a validation method "inlinehtml". It can content inline HTML tags like a, img, span', 'text_domain'), 'validate' => 'wp_editor')))));
$multitabs_menu = new WP_Opton_Page_Wrapper();
$multitabs_menu->create($create_multitabs_option_page);
コード例 #2
0
<?php

$create_notab_option_page = array('parent_slug' => 'options-general.php', 'page_title' => __('Notab Option Page', 'text_domain'), 'menu_title' => __('Notab Option Page', 'text_domain'), 'capability' => 'manage_options', 'menu_slug' => 'menu_slug_page', 'option_name' => 'notab_options', 'fields' => array(array('id' => 'text', 'type' => 'text', 'name' => __('Text Example', 'text_domain'), 'desc' => __('Description for text', 'text_domain'), 'std' => __('Default Value', 'text_domain')), array('id' => 'email', 'type' => 'email', 'name' => __('Email Example', 'text_domain'), 'desc' => __('Description for email', 'text_domain'), 'std' => get_option('admin_email')), array('id' => 'url', 'type' => 'url', 'name' => __('URL Example', 'text_domain'), 'desc' => __('Description for url', 'text_domain'), 'std' => site_url()), array('id' => 'number', 'type' => 'number', 'name' => __('Number Example', 'text_domain'), 'desc' => '', 'std' => 123456789), array('id' => 'checkbox', 'type' => 'checkbox', 'name' => __('Checkbox Example', 'text_domain'), 'std' => 1), array('id' => 'color', 'type' => 'color', 'name' => __('Color Picker Example', 'text_domain'), 'std' => '#ffffff'), array('id' => 'date', 'type' => 'date', 'name' => __('Date Picker Example', 'text_domain'), 'std' => date("m/d/Y", time())), array('id' => 'radio', 'type' => 'radio', 'name' => __('Radio Example', 'text_domain'), 'std' => 'choice_two', 'options' => array('choice_one' => 'Choice One', 'choice_two' => 'Choice Two', 'choice_three' => 'Choice Three', 'choice_four' => 'Choice Four')), array('id' => 'select', 'type' => 'select', 'name' => __('Select Example', 'text_domain'), 'std' => 'choice_three', 'options' => array('choice_one' => 'Choice One', 'choice_two' => 'Choice Two', 'choice_three' => 'Choice Three', 'choice_four' => 'Choice Four')), array('id' => 'textarea', 'type' => 'textarea', 'name' => __('Textarea Example', 'text_domain'), 'desc' => __('This textarea does not declare any validation method. You cannot add any HTML tag here.', 'text_domain'), 'std' => __('Default Value', 'text_domain')), array('id' => 'textarea2', 'type' => 'textarea', 'name' => __('Textarea Example', 'text_domain'), 'desc' => __('This textarea declare a validation method "inlinehtml". It can content inline HTML tags like a, img, span', 'text_domain'), 'validate' => 'inlinehtml'), array('id' => 'wp_editor', 'type' => 'wp_editor', 'name' => __('Editor Example', 'text_domain'), 'desc' => __('This textarea declare a validation method "inlinehtml". It can content inline HTML tags like a, img, span', 'text_domain'), 'validate' => 'wp_editor'), array('id' => 'file', 'type' => 'file', 'name' => __('File Uplode Example', 'text_domain'), 'btn_browse' => __('Browse File', 'text_domain'), 'btn_insert' => __('Insert Into Page', 'text_domain'), 'multiple' => true)));
$option_page = new WP_Opton_Page_Wrapper();
$option_page->create($create_notab_option_page);