function set_up_options() { global $wpdb; $table_name = $wpdb->prefix . 'chatwee_moderators'; $sql = "CREATE TABLE {$table_name} (\r\n\t\t id int(11) NOT NULL AUTO_INCREMENT,\r\n\t\t user_id int(11) DEFAULT NULL,\r\n\t\t UNIQUE KEY id (id)\r\n\t\t);"; require_once ABSPATH . 'wp-admin/includes/upgrade.php'; dbDelta($sql); register_setting('chatwee-settings-group', 'is_home'); register_setting('chatwee-settings-group', 'is_search'); register_setting('chatwee-settings-group', 'is_archive'); register_setting('chatwee-settings-group', 'is_page'); register_setting('chatwee-settings-group', 'is_single'); register_setting('chatwee-settings-group', 'ssostatus'); register_setting('chatwee-settings-group', 'clientid'); register_setting('chatwee-settings-group', 'keyapi'); register_setting('chatwee-settings-group', 'loginallsubdomains'); register_setting('chatwee-settings-group', 'group_moderators_editor'); register_setting('chatwee-settings-group', 'group_moderators_author'); register_setting('chatwee-settings-group', 'group_moderators_contributor'); register_setting('chatwee-settings-group', 'group_moderators_subscriber'); register_setting('chatwee-settings-group', 'display_format'); update_option('chatwee-settings-group[is_home]', "on"); update_option('chatwee-settings-group[display_format]', 0); update_option('chatwee-settings-group[is_search]', "on"); update_option('chatwee-settings-group[is_archive]', "on"); update_option('chatwee-settings-group[is_single]', "on"); update_option('chatwee-settings-group[is_page]', "on"); update_option('chatwee-settings-group[ssostatus]', "on"); update_option('chatwee-settings-group[loginallsubdomains]', "on"); update_option('chatwee', ""); }
public function getOptionsForm() { // Hook to add stuff after the options form add_action('optionform-after', array($this, 'renderStatus')); register_setting('wptripolis-group', 'wptripolis-options', array($this, 'sanitize')); return array('sections' => array(array('title' => 'API Account Settings', 'callback' => array($this, 'validateAccount'), 'fields' => array(array('name' => 'client_environment', 'label' => __('Tripolis Environment', 'tripolis'), 'type' => 'select', 'args' => array('options' => array('https://td42.tripolis.com', 'https://td43.tripolis.com'), 'val_is_key' => true, 'default' => 'https://td43.tripolis.com')), array('name' => 'client_account', 'label' => __('Client Account', 'tripolis')), array('name' => 'client_username', 'label' => __('Username', 'tripolis')), array('name' => 'client_password', 'label' => __('Password', 'tripolis'), 'type' => 'password'), array('name' => 'client_validated', 'label' => '', 'type' => 'hidden', 'args' => array('default' => 0)))))); }
function ylb_register_options_group() { /*vietato ai minori*/ register_setting('ylb_options_group', 'xvp_code_vm_popup'); /*ADS Popup */ register_setting('ylb_options_group', 'xvp_code_ads_popup'); register_setting('ylb_options_group', 'xvp_close_ads_popup'); /*post home*/ register_setting('ylb_options_group', 'xvp_code_top_ads_home'); register_setting('ylb_options_group', 'xvp_close_box_home_effect'); register_setting('ylb_options_group', 'xvp_code_home_netamici'); register_setting('ylb_options_group', 'xvp_code_home_netamici_link'); register_setting('ylb_options_group', 'xvp_code_sidebar_quadtrato'); /*post sopra*/ register_setting('ylb_options_group', 'xvp_code_top_ads_post'); register_setting('ylb_options_group', 'xvp_close_box_effect'); /*post sotto*/ register_setting('ylb_options_group', 'xvp_code_bottom_ads_post'); register_setting('ylb_options_group', 'xvp_close_box_bottom_effect'); register_setting('ylb_options_group', 'xvp_code_sidebar_quadtrato'); /*footer*/ register_setting('ylb_options_group', 'xvp_code_footer'); /*template full*/ register_setting('ylb_options_group', 'xvp_code_template_full'); //register_setting('ylb_options_group', 'xvp_code_random_post_sidebar'); register_setting('ylb_options_group', 'xvp_close_sidebar_effect'); register_setting('ylb_options_group', 'xvp_code_analytics'); register_setting('ylb_options_group', 'xvp_code_titolo_home_seo'); register_setting('ylb_options_group', 'xvp_code_desc_home_seo'); register_setting('ylb_options_group', 'xvp_code_key_home_seo'); register_setting('ylb_options_group', 'xvp_code_h1_home_seo'); }
function optionsframework_init() { // Include the required files require_once dirname(__FILE__) . '/options-interface.php'; require_once dirname(__FILE__) . '/options-medialibrary-uploader.php'; // Loads the options array from the theme if ($optionsfile = locate_template(array('options.php'))) { require_once $optionsfile; } else { if (file_exists(dirname(__FILE__) . '/options.php')) { require_once dirname(__FILE__) . '/options.php'; } } $optionsframework_settings = get_option('optionsframework'); // Updates the unique option id in the database if it has changed optionsframework_option_name(); // Gets the unique id, returning a default if it isn't defined if (isset($optionsframework_settings['id'])) { $option_name = $optionsframework_settings['id']; } else { $option_name = 'optionsframework'; } // If the option has no saved data, load the defaults if (!get_option($option_name)) { optionsframework_setdefaults(); } // Registers the settings fields and callback register_setting('optionsframework', $option_name, 'optionsframework_validate'); // Change the capability required to save the 'optionsframework' options group. add_filter('option_page_capability_optionsframework', 'optionsframework_page_capability'); }
public function setup_settings() { // General add_settings_section('bp-docs-general', __('General', 'bp-docs'), array($this, 'general_section'), 'bp-docs-settings'); // General - Docs slug add_settings_field('bp-docs-slug', __('Slug', 'bp-docs'), array($this, 'slug_setting_markup'), 'bp-docs-settings', 'bp-docs-general'); register_setting('bp-docs-settings', 'bp-docs-slug', 'rawurlencode'); // General - Excerpt length add_settings_field('bp-docs-excerpt-length', __('Directory Excerpt Length', 'bp-docs'), array($this, 'excerpt_length_setting_markup'), 'bp-docs-settings', 'bp-docs-general'); register_setting('bp-docs-settings', 'bp-docs-excerpt-length', 'absint'); // Users add_settings_section('bp-docs-users', __('Users', 'bp-docs'), array($this, 'users_section'), 'bp-docs-settings'); // Users - Tab name add_settings_field('bp-docs-user-tab-name', __('User Tab Name', 'bp-docs'), array($this, 'user_tab_name_setting_markup'), 'bp-docs-settings', 'bp-docs-users'); register_setting('bp-docs-settings', 'bp-docs-user-tab-name'); // Groups if (bp_is_active('groups')) { add_settings_section('bp-docs-groups', __('Groups', 'bp-docs'), array($this, 'groups_section'), 'bp-docs-settings'); // Groups - Tab name add_settings_field('bp-docs-tab-name', __('Group Tab Name', 'bp-docs'), array($this, 'group_tab_name_setting_markup'), 'bp-docs-settings', 'bp-docs-groups'); register_setting('bp-docs-settings', 'bp-docs-tab-name'); } // Attachments add_settings_section('bp-docs-attachments', __('Attachments', 'bp-docs'), array($this, 'attachments_section'), 'bp-docs-settings'); // Users - Tab name add_settings_field('bp-docs-enable-attachments', __('Enable Attachments', 'bp-docs'), array($this, 'enable_attachments_setting_markup'), 'bp-docs-settings', 'bp-docs-attachments'); register_setting('bp-docs-settings', 'bp-docs-enable-attachments'); }
function email_downloads_settings_init() { register_setting('ed', 'email_downloads_settings'); add_settings_section('email_downloads_ed_section', __('Basic Settings', 'email-downloads'), 'email_downloads_settings_section_callback', 'ed'); add_settings_field('ed_sender_email', __('Sender Email', 'email-downloads'), 'email_downloads_sender_email_render', 'ed', 'email_downloads_ed_section'); add_settings_field('ed_sender_name', __('Name of the Sender', 'email-downloads'), 'email_downloads_sender_name_render', 'ed', 'email_downloads_ed_section'); }
public function settings_init() { register_setting('pluginPage', 'insertagram_settings'); add_settings_section('insertagram_pluginPage_section', __('', 'insertagram'), false, 'pluginPage'); add_settings_field('insertagram_text_instagram_user_id', __('User ID', 'insertagram'), array($this, 'text_instagram_user_id_render'), 'pluginPage', 'insertagram_pluginPage_section'); add_settings_field('insertagram_text_instagram_api_token', __('Access Token', 'insertagram'), array($this, 'text_instagram_api_token_render'), 'pluginPage', 'insertagram_pluginPage_section'); }
public function page_init() { global $klikbayi_settings, $klikbayi_sanitize; $this->options = $klikbayi_settings; $this->groups = $this->mb_group(); $this->default_setting = klikbayi_default_setting('reset'); $this->url = klikbayi_url('url'); $this->domain = klikbayi_url('domain'); $this->blog = klikbayi_blog(); $this->validate = $klikbayi_sanitize; $this->type = $this->validate->type_array(); $this->style = $this->validate->style_array(); $this->plugin_data = get_plugin_data(KLIKBAYI_PLUGIN_PATH . '/klikbayi.php'); register_setting('option_klikbayi', 'klikbayi_option', array($this, 'sanitize')); foreach ($this->groups as $t => $arr) { add_settings_section('setting_section_' . $t, '', array($this, 'print_section_info_' . $t), 'klikbayi_option_' . $t); add_meta_box('meta-box-' . $t, __($arr[0], 'klikbayi'), array($this, 'box_' . $t), 'klikbayi_option_' . $t, 'normal', 'high'); foreach ($arr[1] as $k => $v) { if ('shortcode' == $k || 'sidebar' == $k) { continue; } add_settings_field($k, __($v, 'klikbayi'), array($this, $k . '_cb'), 'klikbayi_option_' . $t, 'setting_section_' . $t); } } }
function roots_theme_options_init() { if (false === roots_get_theme_options()) { add_option('roots_theme_options', roots_get_default_theme_options()); } register_setting('roots_options', 'roots_theme_options', 'roots_theme_options_validate'); }
function admin_init_rrssb() { register_setting('rrssb', 'show_twitter'); register_setting('rrssb', 'show_facebook'); register_setting('rrssb', 'show_google'); register_setting('rrssb', 'show_github'); register_setting('rrssb', 'show_email'); register_setting('rrssb', 'show_linkedin'); register_setting('rrssb', 'show_reddit'); register_setting('rrssb', 'show_pocket'); register_setting('rrssb', 'show_instagram'); register_setting('rrssb', 'show_pinterest'); register_setting('rrssb', 'show_tumblr'); register_setting('rrssb', 'show_youtube'); register_setting('rrssb', 'github_link'); register_setting('rrssb', 'instagram_link'); register_setting('rrssb', 'pinterest_link'); register_setting('rrssb', 'tumblr_link'); register_setting('rrssb', 'youtube_link'); register_setting('rrssb', 'give_rrssb_credit'); register_setting('rrssb', 'show_buttons_below_post'); register_setting('rrssb', 'show_buttons_above_post'); register_setting('rrssb', 'use_rrssb_jquery'); register_setting('rrssb', 'help_improve_rrssb'); register_setting('rrssb', 'rrssb_css'); register_setting('rrssb', 'rrssb_css_classes'); }
function simple_JPEG_quality_register() { register_setting('media', 'simple-JPEG-settings', 'simple_JPEG_validate'); add_settings_section('simple-JPEG-quality-settings', 'JPEG Resizing', 'show_simple_JPEG_quality_settings', 'media'); add_settings_field('simple-JPEG-quality', 'JPEG Quality', 'show_simple_JPEG_quality', 'media', 'simple-JPEG-quality-settings'); add_settings_field('simple-JPEG-override', 'Allow unusual JPEG quality value?', 'show_simple_JPEG_override', 'media', 'simple-JPEG-quality-settings'); }
public static function register_mysettings() { register_setting('evaluate_options', self::$allow_anonymous); add_settings_section('evaluate_general', "General", array(__CLASS__, 'render_general'), self::$page_slug); add_settings_field(self::$allow_anonymous, "Allow Anonymous Users to Vote", array(__CLASS__, 'render_general_allow_anonymous'), self::$page_slug, 'evaluate_general'); add_settings_field(self::$disable_stylesheet, "Disable the default stylesheet", array(__CLASS__, 'render_general_disable_stylesheet'), self::$page_slug, 'evaluate_general'); }
/** * Register settings. */ public function register_settings() { add_settings_section('ib_educator_learning_settings', __('Learning', 'ibeducator'), array($this, 'section_description'), 'ib_educator_learning_page'); // Setting: add_settings_field('edu_lesson_comments', __('Enable comments on lessons', 'ibeducator'), array($this, 'setting_checkbox'), 'ib_educator_learning_page', 'ib_educator_learning_settings', array('name' => 'lesson_comments', 'settings_group' => 'ib_educator_learning', 'default' => 0, 'id' => 'edu_lesson_comments')); register_setting('ib_educator_learning_settings', 'ib_educator_learning', array($this, 'validate')); }
/** * Plugin settings form fields. * * @return void. */ public function plugin_settings() { $option = 'wcbcf_settings'; // Set Custom Fields cection. add_settings_section('options_section', __('Checkout Custom Fields:', 'woocommerce-extra-checkout-fields-for-brazil'), array($this, 'section_options_callback'), $option); // Person Type option. add_settings_field('person_type', __('Display Person Type:', 'woocommerce-extra-checkout-fields-for-brazil'), array($this, 'select_element_callback'), $option, 'options_section', array('menu' => $option, 'id' => 'person_type', 'description' => __('Individuals enables CPF field and Legal Person enables CNPJ field.', 'woocommerce-extra-checkout-fields-for-brazil'), 'options' => array(0 => __('None', 'woocommerce-extra-checkout-fields-for-brazil'), 1 => __('Individuals and Legal Person', 'woocommerce-extra-checkout-fields-for-brazil'), 2 => __('Individuals only', 'woocommerce-extra-checkout-fields-for-brazil'), 3 => __('Legal Person only', 'woocommerce-extra-checkout-fields-for-brazil')))); // Person Type is Required option. add_settings_field('only_brazil', __('Person Type is requered only in Brazil?', 'woocommerce-extra-checkout-fields-for-brazil'), array($this, 'checkbox_element_callback'), $option, 'options_section', array('menu' => $option, 'id' => 'only_brazil', 'label' => __('If checked the Individuals and Legal Person options will be mandatory only in Brazil.', 'woocommerce-extra-checkout-fields-for-brazil'))); // RG option. add_settings_field('rg', __('Display RG:', 'woocommerce-extra-checkout-fields-for-brazil'), array($this, 'checkbox_element_callback'), $option, 'options_section', array('menu' => $option, 'id' => 'rg', 'label' => __('If checked show the RG field in billing options.', 'woocommerce-extra-checkout-fields-for-brazil'))); // State Registration option. add_settings_field('ie', __('Display State Registration:', 'woocommerce-extra-checkout-fields-for-brazil'), array($this, 'checkbox_element_callback'), $option, 'options_section', array('menu' => $option, 'id' => 'ie', 'label' => __('If checked show the State Registration field in billing options.', 'woocommerce-extra-checkout-fields-for-brazil'))); // Birthdate and Sex option. add_settings_field('birthdate_sex', __('Display Birthdate and Sex:', 'woocommerce-extra-checkout-fields-for-brazil'), array($this, 'checkbox_element_callback'), $option, 'options_section', array('menu' => $option, 'id' => 'birthdate_sex', 'label' => __('If checked show the Birthdate and Sex field in billing options.', 'woocommerce-extra-checkout-fields-for-brazil'))); // Cell Phone option. add_settings_field('cell_phone', __('Display Cell Phone:', 'woocommerce-extra-checkout-fields-for-brazil'), array($this, 'checkbox_element_callback'), $option, 'options_section', array('menu' => $option, 'id' => 'cell_phone', 'label' => __('If checked show the Cell Phone field in billing options.', 'woocommerce-extra-checkout-fields-for-brazil'))); // Set Custom Fields cection. add_settings_section('jquery_section', __('jQuery Options:', 'woocommerce-extra-checkout-fields-for-brazil'), array($this, 'section_options_callback'), $option); // Mail Check option. add_settings_field('mailcheck', __('Enable Mail Check:', 'woocommerce-extra-checkout-fields-for-brazil'), array($this, 'checkbox_element_callback'), $option, 'jquery_section', array('menu' => $option, 'id' => 'mailcheck', 'label' => __('If checked informs typos in email to users.', 'woocommerce-extra-checkout-fields-for-brazil'))); // Input Mask option. add_settings_field('maskedinput', __('Enable Input Mask:', 'woocommerce-extra-checkout-fields-for-brazil'), array($this, 'checkbox_element_callback'), $option, 'jquery_section', array('menu' => $option, 'id' => 'maskedinput', 'label' => __('If checked create masks fill for in fields of CPF, CNPJ, Birthdate, Phone and Cell Phone.', 'woocommerce-extra-checkout-fields-for-brazil'))); // Address Autocomplete option. add_settings_field('addresscomplete', __('Enable Address Autocomplete:', 'woocommerce-extra-checkout-fields-for-brazil'), array($this, 'checkbox_element_callback'), $option, 'jquery_section', array('menu' => $option, 'id' => 'addresscomplete', 'label' => __('If checked automatically complete the address fields based on the zip code.', 'woocommerce-extra-checkout-fields-for-brazil'))); // Set Custom Fields cection. add_settings_section('validation_section', __('Validation:', 'woocommerce-extra-checkout-fields-for-brazil'), array($this, 'section_options_callback'), $option); // Validate CPF option. add_settings_field('validate_cpf', __('Validate CPF:', 'woocommerce-extra-checkout-fields-for-brazil'), array($this, 'checkbox_element_callback'), $option, 'validation_section', array('menu' => $option, 'id' => 'validate_cpf', 'label' => __('Checks if the CPF is valid.', 'woocommerce-extra-checkout-fields-for-brazil'))); // Validate CPF option. add_settings_field('validate_cnpj', __('Validate CNPJ:', 'woocommerce-extra-checkout-fields-for-brazil'), array($this, 'checkbox_element_callback'), $option, 'validation_section', array('menu' => $option, 'id' => 'validate_cnpj', 'label' => __('Checks if the CNPJ is valid.', 'woocommerce-extra-checkout-fields-for-brazil'))); // Register settings. register_setting($option, $option, array($this, 'validate_options')); }
function content_page() { // signale à worpdress de créer l'entrée dans la bdd (table options) register_setting('admin-type-settings', 'admin-type-option', 'admin_type_callback'); // ------------------------------ // création d'une section // ------------------------------ add_settings_section('classics-fieds-section', 'Champs types', 'classics_fields_help', 'admin-type'); // création d'un input text add_settings_field('input-text', 'Input type text', 'display_input_text', 'admin-type', 'classics-fieds-section', array('label_for' => 'input-text', 'option-name' => 'admin-type-option')); // création d'un input checkbox add_settings_field('input-checkbox', 'Input type checkbox', 'display_input_checkbox', 'admin-type', 'classics-fieds-section', array('label_for' => 'input-checkbox', 'value' => '1', 'option-name' => 'admin-type-option')); // création d'un select add_settings_field('select', 'Select', 'display_select_element', 'admin-type', 'classics-fieds-section', array('label_for' => 'select', 'values' => array('Option 1' => 'option_1', 'Option 2' => 'option_2', 'Option 3' => 'option_3'), 'option-name' => 'admin-type-option')); // création d'un textarea add_settings_field('textarea-simple', 'Textarea', 'display_textarea_simple', 'admin-type', 'classics-fieds-section', array('label_for' => 'textarea-simple', 'option-name' => 'admin-type-option')); // ------------------------------ // création d'une section // ------------------------------ add_settings_section('other-fields-section', 'Champs spéciaux', 'other_fields_help', 'admin-type'); // création d'un WYSIWYG add_settings_field('wysiwyg', 'WYSIWYG', 'display_wysiwyg', 'admin-type', 'other-fields-section', array('wysiwyg-name' => 'wysiwyg', 'option-name' => 'admin-type-option')); // création d'un input type file add_settings_field('input-file', 'Input type file', 'display_input_file', 'admin-type', 'other-fields-section', array('label_for' => 'input-file', 'option-name' => 'admin-type-option')); }
/** * Register the form setting for our sunspot_options array. * * This function is attached to the admin_init action hook. * * This call to register_setting() registers a validation callback, sunspot_theme_options_validate(), * which is used when the option is saved, to ensure that our option values are complete, properly * formatted, and safe. * * We also use this function to add our theme option if it doesn't already exist. * * @since Sunspot 1.0 */ function sunspot_theme_options_init() { // If we have no options in the database, let's add them now. if ( false === sunspot_get_theme_options() ) add_option( 'sunspot_theme_options', sunspot_get_default_theme_options() ); register_setting( 'sunspot_options', // Options group, see settings_fields() call in sunspot_theme_options_render_page() 'sunspot_theme_options', // Database option, see sunspot_get_theme_options() 'sunspot_theme_options_validate' // The sanitization callback, see sunspot_theme_options_validate() ); // Register our settings field group add_settings_section( 'general', // Unique identifier for the settings section '', // Section title (we don't want one) '__return_false', // Section callback (we don't want anything) 'theme_options' // Menu slug, used to uniquely identify the page; see sunspot_theme_options_add_page() ); // Register our individual settings fields add_settings_field( 'home_layout', // Unique identifier for the field for this section __( 'How would you like to display posts on the front page?', 'sunspot' ), // Setting field label 'sunspot_settings_home_layout', // Function that renders the settings field 'theme_options', // Menu slug, used to uniquely identify the page; see sunspot_theme_options_add_page() 'general' // Settings section. Same as the first argument in the add_settings_section() above ); }
function register_form_flg_settings() { register_setting('form-flg-settings', 'form-flg-settings', 'validate_settings'); add_settings_section('section-one', 'FLG Setup', 'addsection_settings', 'form_flg_settings'); //FLG Key add_settings_field('settingsfield_flg_key', 'FLG API Key', 'addsettingsfield_flg_key', 'form_flg_settings', 'section-one'); }
/** * Settings Page * Adds Admin Menu Item via WordPress' "Administration Menus" API. Also hook actions to register options via WordPress' Settings API. */ static function admin_load() { // added here to not effect other pages. Theme page requires JavaScript (less.js) or it doesn't make sense to save. add_filter('sns_show_submit_button', '__return_false'); register_setting(SnS_Admin::OPTION_GROUP, 'SnS_options'); add_settings_section('theme', __('Scripts n Styles Theme Files', 'scripts-n-styles'), array(__CLASS__, 'less_fields'), SnS_Admin::MENU_SLUG); }
/** * Adds Gravatar Hovercard setting * * @todo - always print HTML, hide via CSS/JS if !show_avatars */ function grofiles_add_settings() { if ( !get_option( 'show_avatars' ) ) return; add_settings_field( 'gravatar_disable_hovercards', __( 'Gravatar Hovercards', 'jetpack' ), 'grofiles_setting_callback', 'discussion', 'avatars' ); register_setting( 'discussion', 'gravatar_disable_hovercards', 'grofiles_hovercard_option_sanitize' ); }
public function progress_on_scroll_page_init() { register_setting('progress_on_scroll_option_group', 'progress_on_scroll_option_name', array($this, 'progress_on_scroll_sanitize')); add_settings_section('progress_on_scroll_setting_section', 'Settings', array($this, 'progress_on_scroll_section_info'), 'progress-on-scroll-admin'); add_settings_field('fill_0', 'Fill', array($this, 'fill_0_callback'), 'progress-on-scroll-admin', 'progress_on_scroll_setting_section'); add_settings_field('empty_1', 'empty', array($this, 'empty_1_callback'), 'progress-on-scroll-admin', 'progress_on_scroll_setting_section'); }
/** * Customer options for the shop */ public static function declare_options() { if (WPSHOP_DEFINED_SHOP_TYPE == 'sale' && !isset($_POST['wpshop_shop_type']) || isset($_POST['wpshop_shop_type']) && $_POST['wpshop_shop_type'] != 'presentation' && !isset($_POST['old_wpshop_shop_type']) || isset($_POST['old_wpshop_shop_type']) && $_POST['old_wpshop_shop_type'] != 'presentation') { register_setting('wpshop_options', 'wpshop_cart_option', array('wps_customer_ctr', 'wpshop_options_validate_customers_newsleters')); add_settings_field('display_newsletters_subscriptions', __('Display newsletters subscriptions', 'wpshop'), array('wps_customer_ctr', 'display_newsletters_subscriptions'), 'wpshop_cart_info', 'wpshop_cart_info'); } }
/** * Register plugin options * * The plugin settings options are registered * * @param $plugin_settings an array of options each element is an associative array with 1 key and 5 values * the key is the short name of the field. the values are: * name => field label, * callback => the callback used to render the field * default_value => the default value of the field * hidden => used to indicate if the field is hidden * short_name => the short field name * args => the arguments for the callback function */ public final function RegisterPluginOptions($plugin_settings) { /** * Used to indicate if the plugin option should be saved * It allows the plugin options to be used even if the user has not saved the plugin settings from the settings page */ $save_plugin_option = false; /** The wordpress configuration is fetched */ $wordpress_configuration = $this->GetConfig("wordpress"); /** The options id is fetched */ $options_id = $this->GetComponent("application")->GetOptionsId("options"); /** The current plugin options are fetched */ $options = $this->GetComponent("application")->GetPluginOptions($options_id); /** The settings group is registered */ register_setting($wordpress_configuration['plugin_prefix'] . '_option_group', $options_id, array($this, 'Sanitize')); /** If the print section info callback is not defined then an exception is thrown */ $print_section_info_callback = array($this, 'PrintSectionInfo'); if (!is_callable($print_section_info_callback)) { throw new \Exception("PrintSectionInfo callback function is not defined"); } /** The settings section is registered */ add_settings_section($wordpress_configuration['plugin_prefix'] . '_settings_id', '', $print_section_info_callback, $wordpress_configuration['settings_page_url']); /** All of the plugin settings are registered */ foreach ($plugin_settings as $field_short_name => $field_information) { /** The field callback. If it is given as an object name then the object is fetched from application configuration */ $field_callback = is_object($field_information['callback'][0]) ? $field_information['callback'][0] : $this->GetComponent($field_information['callback'][0]); $field_callback = array($field_callback, $field_information['callback'][1]); /** The field label */ $field_label = $field_information['name']; /** Short field name. Used to create name of callback function */ $short_field_name = $field_information['short_name']; /** Indicates if field is hidden */ $is_hidden = $field_information['hidden']; /** Callback function arguments */ $args = $field_information['args']; /** The default field value */ $default_value = $args['default_value']; /** The default field value */ $args['field_name'] = $field_information['short_name']; /** If the settings field is hidden then the field label is set to empty */ if ($is_hidden) { $field_label = ""; } /** If the field callback is not defined then an exception is thrown */ if (!is_callable($field_callback)) { throw new \Exception("The callback for the field: " . $field_label . " was not defined"); } /** The settings field is added to the plugin settings form */ add_settings_field($wordpress_configuration['plugin_prefix'] . '_' . $short_field_name, $field_label, $field_callback, $wordpress_configuration['settings_page_url'], $wordpress_configuration['plugin_prefix'] . '_settings_id', $args); /** The default option value is set */ if (!isset($options[$short_field_name])) { $options[$short_field_name] = $default_value; $save_plugin_option = true; } } /** The options are saved */ if ($save_plugin_option) { $this->GetComponent("application")->SavePluginOptions($options, $options_id); } }
function volcano_custom_settings() { //Sidebar Options register_setting('volcano-settings-group', 'profile_picture'); register_setting('volcano-settings-group', 'first_name'); register_setting('volcano-settings-group', 'last_name'); register_setting('volcano-settings-group', 'user_description'); register_setting('volcano-settings-group', 'twitter_handler', 'volcano_sanitize_twitter_handler'); register_setting('volcano-settings-group', 'facebook_handler'); register_setting('volcano-settings-group', 'gplus_handler'); add_settings_section('volcano-sidebar-options', 'Sidebar Option', 'volcano_sidebar_options', 'testernick_volcano'); add_settings_field('sidebar-profile-picture', 'Profile Picture', 'volcano_sidebar_profile', 'testernick_volcano', 'volcano-sidebar-options'); add_settings_field('sidebar-name', 'Full Name', 'volcano_sidebar_name', 'testernick_volcano', 'volcano-sidebar-options'); add_settings_field('sidebar-description', 'Description', 'volcano_sidebar_description', 'testernick_volcano', 'volcano-sidebar-options'); add_settings_field('sidebar-twitter', 'Twitter handler', 'volcano_sidebar_twitter', 'testernick_volcano', 'volcano-sidebar-options'); add_settings_field('sidebar-facebook', 'Facebook handler', 'volcano_sidebar_facebook', 'testernick_volcano', 'volcano-sidebar-options'); add_settings_field('sidebar-gplus', 'Google+ handler', 'volcano_sidebar_gplus', 'testernick_volcano', 'volcano-sidebar-options'); //Theme Support Options\\ ////////////////////////\\ register_setting('volcano-theme-support', 'post_formats'); register_setting('volcano-theme-support', 'custom_header'); register_setting('volcano-theme-support', 'custom_background'); add_settings_section('volcano-theme-options', 'Theme Options', 'volcano_theme_options', 'testernick_volcano_theme'); add_settings_field('post-formats', 'Post Formats', 'volcano_post_formats', 'testernick_volcano_theme', 'volcano-theme-options'); add_settings_field('custom-header', 'Custom Header', 'volcano_custom_header', 'testernick_volcano_theme', 'volcano-theme-options'); add_settings_field('custom-background', 'Custom Background', 'volcano_custom_background', 'testernick_volcano_theme', 'volcano-theme-options'); //Contact Form Options\\ ///////////////////////\\ register_setting('volcano-contact-options', 'activate_contact'); add_settings_section('volcano-contact-section', 'Contact Form', 'volcano_contact_section', 'testernick_volcano_theme_contact'); add_settings_field('activate-form', 'Activate Contact Form', 'volcano_activate_contact', 'testernick_volcano_theme_contact', 'volcano-contact-section'); }
public function register_settings() { add_settings_section('pronamic_cookie_options_advanced', __('Cookie Settings', 'pronamic-cookies'), array($this, 'settings_section'), 'pronamic_cookie_options_advanced_page'); add_settings_field('pronamic_cookie_options_advanced_path', __('Path', 'pronamic-cookies'), array($this, 'text'), 'pronamic_cookie_options_advanced_page', 'pronamic_cookie_options_advanced', array('label_for' => 'pronamic_cookie_options_advanced_path')); add_settings_field('pronamic_cookie_options_advanced_expires', __('Expires', 'pronamic-cookies'), array($this, 'text'), 'pronamic_cookie_options_advanced_page', 'pronamic_cookie_options_advanced', array('label_for' => 'pronamic_cookie_options_advanced_expires', 'description' => __('Use a string that would go in <a href="http://php.net/manual/en/function.strtotime.php">strtotime</a>', 'pronamic-cookies'))); register_setting('pronamic_cookie_options_advanced', 'pronamic_cookie_options_advanced_path'); register_setting('pronamic_cookie_options_advanced', 'pronamic_cookie_options_advanced_expires'); // Base Settings add_settings_section('pronamic_cookie_options', __('Bar', 'pronamic-cookies'), array($this, 'settings_section'), 'pronamic_cookie_options_page'); add_settings_field('pronamic_cookie_base_active', __('Active?', 'pronamic-cookies'), array($this, 'select'), 'pronamic_cookie_options_page', 'pronamic_cookie_options', array('label_for' => 'pronamic_cookie_base_active', 'options' => array(array('label_for' => __('Yes', 'pronamic-cookies'), 'value' => 1), array('label_for' => __('No', 'pronamic-cookies'), 'value' => 0)))); add_settings_field('pronamic_cookie_location', __('Location', 'pronamic-cookies'), array($this, 'select'), 'pronamic_cookie_options_page', 'pronamic_cookie_options', array('label_for' => 'pronamic_cookie_location', 'options' => array(array('label_for' => __('Top', 'pronamic-cookies'), 'value' => 'top'), array('label_for' => __('Bottom', 'pronamic-cookies'), 'value' => 'bottom')))); add_settings_field('pronamic_cookie_text', __('Text', 'pronamic-cookies'), array($this, 'text'), 'pronamic_cookie_options_page', 'pronamic_cookie_options', array('label_for' => 'pronamic_cookie_text')); add_settings_field('pronamic_cookie_link', __('Link', 'pronamic-cookies'), array($this, 'text'), 'pronamic_cookie_options_page', 'pronamic_cookie_options', array('label_for' => 'pronamic_cookie_link')); register_setting('pronamic_cookie_options', 'pronamic_cookie_base_active'); register_setting('pronamic_cookie_options', 'pronamic_cookie_location'); register_setting('pronamic_cookie_options', 'pronamic_cookie_text'); register_setting('pronamic_cookie_options', 'pronamic_cookie_link', array($this, 'verifiy_url')); // Blocker Settings add_settings_section('pronamic_cookie_blocker_options', __('Wall', 'pronamic-cookies'), array($this, 'settings_section'), 'pronamic_cookie_options_page'); add_settings_field('pronamic_cookie_blocker_active', __('Active?', 'pronamic-cookies'), array($this, 'select'), 'pronamic_cookie_options_page', 'pronamic_cookie_blocker_options', array('label_for' => 'pronamic_cookie_blocker_active', 'options' => array(array('label_for' => __('Yes', 'pronamic-cookies'), 'value' => 1), array('label_for' => __('No', 'pronamic-cookies'), 'value' => 0)))); add_settings_field('pronamic_cookie_blocker_title', __('Title', 'pronamic-cookies'), array($this, 'text'), 'pronamic_cookie_options_page', 'pronamic_cookie_blocker_options', array('label_for' => 'pronamic_cookie_blocker_title')); add_settings_field('pronamic_cookie_blocker_text', __('Text', 'pronamic-cookies'), array($this, 'editor'), 'pronamic_cookie_options_page', 'pronamic_cookie_blocker_options', array('label_for' => 'pronamic_cookie_blocker_text')); add_settings_field('pronamic_cookie_blocker_show_link', __('Show link?', 'pronamic-cookies'), array($this, 'select'), 'pronamic_cookie_options_page', 'pronamic_cookie_blocker_options', array('label_for' => 'pronamic_cookie_blocker_show_link', 'options' => array(array('label_for' => __('Yes', 'pronamic-cookies'), 'value' => 1), array('label_for' => __('No', 'pronamic-cookies'), 'value' => 0)))); add_settings_field('pronamic_cookie_blocker_image', __('Background Image', 'pronamic-cookies'), array($this, 'uploader'), 'pronamic_cookie_options_page', 'pronamic_cookie_blocker_options', array('label_for' => 'pronamic_cookie_blocker_image')); add_settings_field('pronamic_cookie_blocker_bgcolor', __('Background Color', 'pronamic-cookies'), array($this, 'colorpicker'), 'pronamic_cookie_options_page', 'pronamic_cookie_blocker_options', array('label_for' => 'pronamic_cookie_blocker_bgcolor')); register_setting('pronamic_cookie_options', 'pronamic_cookie_blocker_active'); register_setting('pronamic_cookie_options', 'pronamic_cookie_blocker_title'); register_setting('pronamic_cookie_options', 'pronamic_cookie_blocker_text'); register_setting('pronamic_cookie_options', 'pronamic_cookie_blocker_show_link'); register_setting('pronamic_cookie_options', 'pronamic_cookie_blocker_image'); register_setting('pronamic_cookie_options', 'pronamic_cookie_blocker_bgcolor'); }
/** * Initializes all the theme settings page functionality. This function is used to create the theme settings * page, then use that as a launchpad for specific actions that need to be tied to the settings page. * * @since 0.7.0 * @global string $hybrid The global theme object. * @return void */ function hybrid_settings_page_init() { global $hybrid; /* Get theme information. */ $theme = wp_get_theme(get_template(), get_theme_root(get_template_directory())); $prefix = hybrid_get_prefix(); /* Register theme settings. */ register_setting("{$prefix}_theme_settings", "{$prefix}_theme_settings", 'hybrid_save_theme_settings'); /* Create the theme settings page. */ $hybrid->settings_page = add_theme_page(sprintf(esc_html__('%s Theme Settings', 'hybrid-core'), $theme->get('Name')), esc_html__('Theme Settings', 'hybrid-core'), hybrid_settings_page_capability(), 'theme-settings', 'hybrid_settings_page'); /* Check if the settings page is being shown before running any functions for it. */ if (!empty($hybrid->settings_page)) { /* Filter the settings page capability so that it recognizes the 'edit_theme_options' cap. */ add_filter("option_page_capability_{$prefix}_theme_settings", 'hybrid_settings_page_capability'); /* Add help tabs to the theme settings page. */ add_action("load-{$hybrid->settings_page}", 'hybrid_settings_page_help'); /* Load the theme settings meta boxes. */ add_action("load-{$hybrid->settings_page}", 'hybrid_load_settings_page_meta_boxes'); /* Create a hook for adding meta boxes. */ add_action("load-{$hybrid->settings_page}", 'hybrid_settings_page_add_meta_boxes'); /* Load the JavaScript and stylesheets needed for the theme settings screen. */ add_action('admin_enqueue_scripts', 'hybrid_settings_page_enqueue_scripts'); add_action('admin_enqueue_scripts', 'hybrid_settings_page_enqueue_styles'); add_action("admin_footer-{$hybrid->settings_page}", 'hybrid_settings_page_load_scripts'); } }
function pluginheadingssettings() { register_setting('headings-settings', 'headings-label-1-1'); register_setting('headings-settings', 'headings-label-1-2'); register_setting('headings-settings', 'headings-label-1-3'); register_setting('headings-settings', 'headings-label-2-1'); register_setting('headings-settings', 'headings-label-2-2'); register_setting('headings-settings', 'headings-label-2-3'); register_setting('headings-settings', 'headings-label-3-1'); register_setting('headings-settings', 'headings-label-3-2'); register_setting('headings-settings', 'headings-label-3-3'); register_setting('headings-settings', 'headings-label-4-1'); register_setting('headings-settings', 'headings-label-4-2'); register_setting('headings-settings', 'headings-label-4-3'); register_setting('headings-settings', 'headings-label-5-1'); register_setting('headings-settings', 'headings-label-5-2'); register_setting('headings-settings', 'headings-label-5-3'); register_setting('headings-settings', 'headings-label-6-1'); register_setting('headings-settings', 'headings-label-6-2'); register_setting('headings-settings', 'headings-label-6-3'); register_setting('headings-settings', 'headings-label-7-1'); register_setting('headings-settings', 'headings-label-7-2'); register_setting('headings-settings', 'headings-label-7-3'); register_setting('headings-settings', 'headings-label-8-1'); register_setting('headings-settings', 'headings-label-8-2'); register_setting('headings-settings', 'headings-label-8-3'); register_setting('headings-settings', 'headings-label-9-1'); register_setting('headings-settings', 'headings-label-9-2'); register_setting('headings-settings', 'headings-label-9-3'); register_setting('headings-settings', 'headings-label-10-1'); register_setting('headings-settings', 'headings-label-10-2'); register_setting('headings-settings', 'headings-label-10-3'); }
function register_my_cool_plugin_settings() { //register our settings register_setting('my-cool-plugin-settings-group', 'new_option_name'); register_setting('my-cool-plugin-settings-group', 'some_other_option'); register_setting('my-cool-plugin-settings-group', 'option_etc'); }
/** * Register and add settings */ public function page_init() { register_setting('my_option_group', 'my_option_name', array($this, 'sanitize')); add_settings_section('setting_section_id', 'My Custom Settings', array($this, 'print_section_info'), 'my-setting-admin'); add_settings_field('id_number', 'ID Number', array($this, 'id_number_callback'), 'my-setting-admin', 'setting_section_id'); add_settings_field('title', 'Title', array($this, 'title_callback'), 'my-setting-admin', 'setting_section_id'); }
function admin_init() { global $pagenow; // error handling if ($pagenow == 'post.php') { // get errors $this->errors = get_option($this->transient_key); // if errors unset the 'published' message if ($this->errors && isset($_GET['message']) && $_GET['message'] == 6) { unset($_GET['message']); } } add_settings_section('required_fields', __('Required fields'), array($this, 'section'), 'writing'); $fields = apply_filters('required_fields', array('post_title' => array('title' => __('Title'), 'setting_cb' => 'intval', 'setting_field' => array('required_fields', 'checkbox_field'), 'message' => '', 'validation_cb' => false, 'post_types' => 'any'), 'post_content' => array('title' => __('Content'), 'setting_cb' => 'intval', 'setting_field' => array('required_fields', 'checkbox_field'), 'message' => '', 'validation_cb' => false, 'post_types' => 'any'), 'post_excerpt' => array('title' => __('Excerpt'), 'setting_cb' => 'intval', 'setting_field' => array('required_fields', 'checkbox_field'), 'message' => '', 'validation_cb' => false, 'post_types' => 'post'), 'category' => array('title' => __('Category'), 'setting_cb' => 'intval', 'setting_field' => array('required_fields', 'checkbox_field'), 'message' => __('You must choose a category other than the default.'), 'validation_cb' => array('required_fields', '_has_category'), 'post_types' => 'post'))); foreach ($fields as $name => $field) { $field_name = "require_{$name}"; $field_value = get_option($field_name); add_settings_field($field_name, $field['title'], $field['setting_field'], 'writing', 'required_fields', array('name' => $field_name, 'value' => $field_value)); register_setting('writing', $field_name, $field['setting_cb']); // if the setting validation returns true register the field as required if (call_user_func($field['setting_cb'], $field_value)) { $this->register($field['title'], $name, $field['message'], $field['validation_cb'], $field['post_types']); } } }
public function register_settings() { // Event Settings register_setting(self::$menu_slug, self::$setting_prefix . 'show_location_after_description'); register_setting(self::$menu_slug, self::$setting_prefix . 'show_full_description'); register_setting(self::$menu_slug, self::$setting_prefix . 'sort_events'); // Date Settings register_setting(self::$menu_slug, self::$setting_prefix . 'show_dates'); register_setting(self::$menu_slug, self::$setting_prefix . 'date_format'); register_setting(self::$menu_slug, self::$setting_prefix . 'time_format'); // custom_date_field is registered but it doesn't have a settings filed added. // That is added manually in the settings-fields. register_setting(self::$menu_slug, self::$setting_prefix . 'custom_date_format'); register_setting(self::$menu_slug, self::$setting_prefix . 'custom_time_format'); register_setting(self::$menu_slug, self::$setting_prefix . 'show_sold_out_dates'); register_setting(self::$menu_slug, self::$setting_prefix . 'show_past_dates'); register_setting(self::$menu_slug, self::$setting_prefix . 'show_end_time'); // Price Settings register_setting(self::$menu_slug, self::$setting_prefix . 'show_prices'); register_setting(self::$menu_slug, self::$setting_prefix . 'shipping_methods'); register_setting(self::$menu_slug, self::$setting_prefix . 'shipping_countries'); register_setting(self::$menu_slug, self::$setting_prefix . 'currency'); register_setting(self::$menu_slug, self::$setting_prefix . 'price_sort'); register_setting(self::$menu_slug, self::$setting_prefix . 'show_sold_out_prices'); register_setting(self::$menu_slug, self::$setting_prefix . 'include_service_fee'); register_setting(self::$menu_slug, self::$setting_prefix . 'price_max_quantity'); register_setting(self::$menu_slug, self::$setting_prefix . 'hidden_prices'); register_setting(self::$menu_slug, self::$setting_prefix . 'price_intervals'); register_setting(self::$menu_slug, self::$setting_prefix . 'price_include_fee'); }