本文整理汇总了PHP中add_settings_field函数的典型用法代码示例。如果您正苦于以下问题:PHP add_settings_field函数的具体用法?PHP add_settings_field怎么用?PHP add_settings_field使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_settings_field函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor.
*
* Register an administration breadcrumb settings field.
*
* @access public
*
* @param string $id The ID of the field.
* @param string $title The title of the field.
* @param string $section The name of the section.
* @param array $args Additional args.
*/
public function __construct($id, $title, $section = '', $args = array())
{
$this->set_id($id);
$this->set_title($title);
add_settings_field($id, $title, array($this, 'render'), Carbon_Breadcrumb_Admin_Settings::get_page_name(), $section, $args);
register_setting(Carbon_Breadcrumb_Admin_Settings::get_page_name(), $id);
}
示例2: declare_options
/**
* 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');
}
}
示例3: sunspot_theme_options_init
/**
* 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
);
}
示例4: page_init
/**
* 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');
}
示例5: volcano_custom_settings
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');
}
示例6: register_import_section
public function register_import_section()
{
add_settings_section('import_settings_section', __('Import Options', 'wp-spotim'), array($this, 'import_settings_section_header'), $this->options->slug);
add_settings_field('import_token', __('Your Token', 'wp-spotim'), array('SpotIM_Form_Helper', 'text_field'), $this->options->slug, 'import_settings_section', array('id' => 'import_token', 'page' => $this->options->slug, 'description' => 'Don\'t have a token? please send us an email to support@spot.im and get one.', 'value' => $this->options->get('import_token')));
add_settings_field('posts_per_request', __('Posts Per Request', 'wp-spotim'), array('SpotIM_Form_Helper', 'text_field'), $this->options->slug, 'import_settings_section', array('id' => 'posts_per_request', 'page' => $this->options->slug, 'description' => 'Amount of posts to retrieve in each request, depending on your server\'s strength.', 'value' => $this->options->get('posts_per_request')));
add_settings_field('import_button', '', array('SpotIM_Form_Helper', 'import_button'), $this->options->slug, 'import_settings_section', array('import_button' => array('id' => 'import_button', 'text' => __('Import', 'wp-spotim')), 'cancel_import_link' => array('id' => 'cancel_import_link', 'text' => __('Cancel', 'wp-spotim'))));
}
示例7: plugin_settings
/**
* 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'));
}
开发者ID:pensesmart,项目名称:woocommerce-extra-checkout-fields-for-brazil,代码行数:39,代码来源:class-wc-ecfb-settings.php
示例8: page_init
/**
* Register and add settings
*/
public function page_init()
{
register_setting('asso1901_settings_group', 'asso1901-settings', array($this, 'sanitize'));
add_settings_section('setting_section_id', 'Personnalisation du plugin', array($this, 'print_section_info'), 'asso1901-setting-admin');
add_settings_field('asso1901-name', 'Nom de l\'association', array($this, 'asso1901_name_callback'), 'asso1901-setting-admin', 'setting_section_id');
add_settings_field('asso1901-title', 'Title', array($this, 'asso1901_title_callback'), 'asso1901-setting-admin', 'setting_section_id');
}
示例9: plugin_admin_init
function plugin_admin_init()
{
register_setting('require_login', 'require_login', 'plugin_options_validate');
//register_setting('require_login', 'require_login');
add_settings_section('rl_main', 'Main Options', 'rl_section_text', 'require_login');
add_settings_field('require_login', 'Enabled?', 'rl_setting_string', 'require_login', 'rl_main');
}
示例10: registerSettings
/**
* register settings for our plugin
*/
function registerSettings()
{
//register our settings
register_setting('wtb_seo_settings_main_group', 'wtb_seo_main', array($this, 'sanitize'));
add_settings_section('wtb_seo_settings_main_section', __('On-Page and Post Options', 'wtb_seo'), null, 'wtb_seo_settings');
// ideal density
add_settings_field('ideal_density', __('Ideal keyword density (default: 3%)', 'wtb_seo'), array($this, 'create_an_ideal_density_field'), 'wtb_seo_settings', 'wtb_seo_settings_main_section');
// ideal lenght
add_settings_field('ideal_lenght', __('Ideal post lenght (default: 250)', 'wtb_seo'), array($this, 'create_an_ideal_lenght_field'), 'wtb_seo_settings', 'wtb_seo_settings_main_section');
// checkboxes to check
add_settings_field('to_check', __('Parameter to check', 'wtb_seo'), array($this, 'create_to_check_fields'), 'wtb_seo_settings', 'wtb_seo_settings_main_section');
// wfd or density
add_settings_field('wdf_vs_density', __('Keyword density or WDF to show', 'wtb_seo'), array($this, 'create_an_wdf_vs_density_field'), 'wtb_seo_settings', 'wtb_seo_settings_main_section');
// custom post types
add_settings_section('wtb_seo_settings_cpt_section', __('Activate in custom post types', 'wtb_seo'), null, 'wtb_seo_settings');
add_settings_field('cpt', __('Custom post types', 'wtb_seo'), array($this, 'create_an_custom_post_types_fields'), 'wtb_seo_settings', 'wtb_seo_settings_cpt_section');
// woocommerce
if (is_plugin_active('woocommerce/woocommerce.php')) {
add_settings_section('wtb_seo_settings_woo_section', __('WooCommerce settings', 'wtb_seo'), null, 'wtb_seo_settings');
add_settings_field('check_short_description', __('Check short description', 'wtb_seo'), array($this, 'create_check_short_description'), 'wtb_seo_settings', 'wtb_seo_settings_woo_section');
}
// auto refresh
add_settings_section('wtb_seo_settings_ar_section', __('Auto refresh settings', 'wtb_seo'), null, 'wtb_seo_settings');
add_settings_field('disable_auto_refresh', __('Disabled', 'wtb_seo'), array($this, 'create_auto_refresh_disable'), 'wtb_seo_settings', 'wtb_seo_settings_ar_section');
add_settings_field('auto_refresh_time', __('Auto refresh after (sec.)', 'wtb_seo'), array($this, 'create_auto_refresh_time'), 'wtb_seo_settings', 'wtb_seo_settings_ar_section');
}
示例11: my_general_section
function my_general_section()
{
add_settings_section('my_settings_section', 'My Options Title', 'my_section_options_callback', 'general');
add_settings_field('address', 'Address', 'my_textbox_callback', 'general', 'my_settings_section', array('address'));
add_settings_field('city', 'City', 'my_textbox_callback', 'general', 'my_settings_section', array('city'));
add_settings_field('telephone1', 'Telephone1', 'my_textbox_callback', 'general', 'my_settings_section', array('telephone1'));
add_settings_field('telephone2', 'Telephone2', 'my_textbox_callback', 'general', 'my_settings_section', array('telephone2'));
add_settings_field('fax', 'Fax', 'my_textbox_callback', 'general', 'my_settings_section', array('fax'));
add_settings_field('email', 'Email', 'my_textbox_callback', 'general', 'my_settings_section', array('email'));
add_settings_field('website', 'Website', 'my_textbox_callback', 'general', 'my_settings_section', array('website'));
add_settings_field('facebook', 'Facebook url', 'my_textbox_callback', 'general', 'my_settings_section', array('facebook'));
add_settings_field('instagram', 'Instagram url', 'my_textbox_callback', 'general', 'my_settings_section', array('instagram'));
add_settings_field('twitter', 'Twitter url', 'my_textbox_callback', 'general', 'my_settings_section', array('twitter'));
add_settings_field('pinterest', 'Pinterest url', 'my_textbox_callback', 'general', 'my_settings_section', array('pinterest'));
add_settings_field('phone', 'Header phone no', 'my_textbox_callback', 'general', 'my_settings_section', array('phone'));
add_settings_field('map-link', 'Map URL', 'my_textbox_callback', 'general', 'my_settings_section', array('map-link'));
register_setting('general', 'address', 'esc_attr');
register_setting('general', 'city', 'esc_attr');
register_setting('general', 'telephone1', 'esc_attr');
register_setting('general', 'telephone2', 'esc_attr');
register_setting('general', 'fax', 'esc_attr');
register_setting('general', 'email', 'esc_attr');
register_setting('general', 'website', 'esc_attr');
register_setting('general', 'facebook', 'esc_attr');
register_setting('general', 'instagram', 'esc_attr');
register_setting('general', 'twitter', 'esc_attr');
register_setting('general', 'pinterest', 'esc_attr');
register_setting('general', 'phone', 'esc_attr');
register_setting('general', 'map-link', 'esc_attr');
}
示例12: annframe_admin_components
/**
* Please consider this projecct as an assigment from new PHP & WordPress student
* and forgive me for mistakes in my codes.
*
* This is initial commit and i am working to get this plugin on track
* Contributions to this plugin is much more appreciated
* because we togther can make something cool and ofcourse i will get
* great things to learn from you.
*
* I am looking forward for your Contributions
*
*
*
*@package annOptions
*@version 1.0
*@since 1.0
**/
function annframe_admin_components()
{
$annframe_options = annframe_opt_arr();
register_setting('ann_sections', 'annframedb_options');
//add_settings_section( 'general_settings', '', null, 'annSettings' );
foreach ($annframe_options['sections'] as $key) {
add_settings_section($key['id'], $key['title'], null, 'annSettings');
}
foreach ($annframe_options['settings_fields'] as $key) {
switch ($key['type']) {
case 'text':
add_settings_field($key['id'], $key['label'], 'annframe_input_text_callback', 'annSettings', 'general_settings', $key);
break;
case 'textarea':
add_settings_field($key['id'], $key['label'], 'annframe_allinone', $key['menu_slug'], $key['section'], $key);
break;
case 'upload':
add_settings_field($key['id'], $key['label'], 'annframe_allinone', $key['menu_slug'], $key['section'], $key);
break;
case 'checkbox':
add_settings_field($key['id'], $key['label'], 'annframe_allinone', $key['menu_slug'], $key['section'], $key);
break;
case 'radio':
add_settings_field($key['id'], $key['label'], 'annframe_allinone', $key['menu_slug'], $key['section'], $key);
break;
case 'select':
add_settings_field($key['id'], $key['label'], 'annframe_allinone', $key['menu_slug'], $key['section'], $key);
break;
}
}
}
示例13: my_more_options
function my_more_options()
{
add_settings_field('phone', 'Телефон', 'display_phone', 'general');
//'general'-где выводить. Cоздаем поле опции
register_setting('general', 'my_phone');
//'my_phone' - название опции, которая будет сохраняться в БД. Регистрирует новую опцию и callback функции (функцию обратного вызова) для обработки значения опции при её сохранении в БД
}
示例14: options_page_init
function options_page_init()
{
register_setting('credits-coins-options', 'credits-coins-options', array($this, 'sanitize'));
add_settings_section('credits-coins-options', __('Credits Coins Options', 'credits-coins'), array($this, 'print_section_info'), 'credits-coins-options');
add_settings_field('new-user-default-credits', __('Default Credits for a new user', 'credits-coins'), array($this, 'new_user_default_credits_callback'), 'credits-coins-options', 'credits-coins-options');
add_settings_field('post-types-values', __('Post Types with Credits', 'credits-coins'), array($this, 'post_types_values_callback'), 'credits-coins-options', 'credits-coins-options');
}
示例15: email_downloads_settings_init
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');
}