* Simple options: * input text, checbox, select, radio * textarea */ //title $options_panel->Title(__("Simple Options", "apc")); //An optionl descrption paragraph $options_panel->addParagraph(__("This is a simple paragraph", "apc")); //text field $options_panel->addText('text_field_id', array('name' => __('My Text ', 'apc'), 'std' => 'text', 'desc' => __('Simple text field description', 'apc'))); //textarea field $options_panel->addTextarea('textarea_field_id', array('name' => __('My Textarea ', 'apc'), 'std' => 'textarea', 'desc' => __('Simple textarea field description', 'apc'))); //checkbox field $options_panel->addCheckbox('checkbox_field_id', array('name' => __('My Checkbox ', 'apc'), 'std' => true, 'desc' => __('Simple checkbox field description', 'apc'))); //select field $options_panel->addSelect('select_field_id', array('selectkey1' => 'Select Value1', 'selectkey2' => 'Select Value2'), array('name' => __('My select ', 'apc'), 'std' => array('selectkey2'), 'desc' => __('Simple select field description', 'apc'))); //radio field $options_panel->addRadio('radio_field_id', array('radiokey1' => 'Radio Value1', 'radiokey2' => 'Radio Value2'), array('name' => __('My Radio Filed', 'apc'), 'std' => array('radiokey2'), 'desc' => __('Simple radio field description', 'apc'))); /** * Close first tab */ $options_panel->CloseTab(); /** * Open admin page Second tab */ $options_panel->OpenTab('options_2'); /** * Add fields to your admin page 2nd tab * * Fancy options: * typography field
function sw_optionsClass() { // Fetch the Options Array - This is the sw_options filter hook global $sw_options; $sw_options = apply_filters('sw_options', $sw_options); // Initiate the Options Class with the config settings in the array $options_panel = new BF_Admin_Page_Class($sw_options['config']); // Open the Options Tabs Container $options_panel->OpenTabs_container(''); // Execute the list of options tabs $options_panel->TabsListing($sw_options['tabs']); // Loop through the options tabs and build the options page foreach ($sw_options['options'] as $tabName => $tabOptions) { $options_panel->OpenTab($tabName); // Loop through and output the options for this tab foreach ($tabOptions as $key => $option) { // TITLE - Add a Title if ($option['type'] == 'title') { $options_panel->Title($option['content']); } // PARAGRAPH - Add a Paragraph of Information if ($option['type'] == 'paragraph') { $options_panel->addParagraph($option['content']); } // TEXTBOX - Add a Textbox option if ($option['type'] == 'textbox') { if (isset($option['default'])) { $options_panel->addText($key, array('name' => $option['content'], 'std' => $option['default'])); } else { $options_panel->addText($key, array('name' => $option['content'])); } } // CHECKBOX - Add a checkbox option if ($option['type'] == 'checkbox') { $options_panel->addCheckbox($key, array('name' => $option['content'], $key => $key, 'std' => $option['default'])); } // SORTABLE - Add a sortable option if ($option['type'] == 'sortable') { $options_panel->addSortable($key, $option['content'], array('name' => $option['name'])); } // SELECT - Add a select option if ($option['type'] == 'select') { $options_panel->addSelect($key, $option['content'], array('name' => $option['name'], 'std' => $option['default'])); } // COLOROPTION - Add a color picker if ($option['type'] == 'colorselect') { $options_panel->addColor($key, array('name' => $option['name'], 'std' => $option['default'])); } } // Close the tab and move on to the next one $options_panel->CloseTab(); } }
$options_panel->TabsListing(array('links' => array('options_1' => __('Basic Options')))); // Open admin page first tab with the id options_1 $options_panel->OpenTab('options_1'); /** * Add fields to your admin page first tab * * Simple options: * input text, checbox, select, radio * textarea */ $data = get_option('wpic_options'); //title $options_panel->Title('Thank you for downloading and installing this plugin! In this page you can setup your default settings for the image carousel.</br> If you are not sure what to do, or what everything in here does, check the installation tab in the plugin\'s download at page located <a href="#" target="_blank">here</a>.'); $options_panel->addParagraph('<h3>Your shortcode: </h3><a href="' . $_SERVER['PHP_SELF'] . '?page=options-general.php_wpic_options">Refresh</a> <span> [wpic color="' . $data['color'] . '" visible="' . $data['visible'] . '" width="' . $data['width'] . '" height="' . $data['height'] . '" speed="' . $data['wait'] . '" auto="' . $data['switch'] . '" ][/wpic]</span>'); //select field $options_panel->addSelect('color', array('blue' => 'Blue', 'green' => 'Green', 'gray' => 'Gray', 'lightbrown' => 'Lightbrown', 'navy' => 'Navy', 'orange' => 'Orange', 'pink' => 'Pink', 'purple' => 'Purple', 'red' => 'Red', 'yellow' => 'Yellow'), array('name' => ' </br>Select the default color of WPIC', 'std' => array('selectkey2'))); //select field $options_panel->addSelect('visible', array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10'), array('name' => ' </br>Select the default amount of visible images', 'std' => array('selectkey2'))); //text field $options_panel->addText('width', array('name' => '</br>Default Image Width <strong>*</strong>')); $options_panel->addText('height', array('name' => '</br>Default Image Height <strong>*</strong>')); $options_panel->addText('wait', array('name' => '</br>Default Transition Time <strong>*</strong> <sub>in Milliseconds</sub>')); $options_panel->addText('switch', array('name' => '</br>Default Switch Transition Time <strong>**</strong> <sub>in Milliseconds</sub>')); $options_panel->addParagraph("</br></br><h3>* Enter a clean number with no units. No need for ms/%/px.</h3>"); $options_panel->addParagraph("<h3>** Enter 0 to disable automatic image switching. The amount of time to wait between each automatic slide change. Enter a clean number with no units. No need for ms/%/px.</h3>"); // Close first tab $options_panel->CloseTab(); $pluginurl = plugins_url('', __FILE__) . "/"; if (!is_admin()) { add_action("wp_enqueue_scripts", "wps_register_scripts", 0); }