本文整理汇总了PHP中new_cmb2_box函数的典型用法代码示例。如果您正苦于以下问题:PHP new_cmb2_box函数的具体用法?PHP new_cmb2_box怎么用?PHP new_cmb2_box使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了new_cmb2_box函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: seventeen_register_exhibition_dates
function seventeen_register_exhibition_dates()
{
$prefix = '_seventeen_';
$exhibition_dates = new_cmb2_box(array('id' => $prefix . 'exhibition_dates', 'title' => __('Exhibition Dates', 'seventeen'), 'object_types' => array('exhibitions'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true));
$exhibition_dates->add_field(array('name' => __('Start Date', 'seventeen'), 'desc' => __('The date the exhibition opens', 'seventeen'), 'id' => $prefix . 'startdate', 'type' => 'text_date_timestamp', 'date_format' => __('d-m-Y', 'seventeen')));
$exhibition_dates->add_field(array('name' => __('End Date', 'seventeen'), 'desc' => __('The date and time the exhibition closes', 'seventeen'), 'id' => $prefix . 'enddate', 'type' => 'text_datetime_timestamp', 'date_format' => __('d-m-Y', 'seventeen')));
}
开发者ID:psflannery,项目名称:seventeen_functionality,代码行数:7,代码来源:cmb2-metaboxes.php
示例2: webinar_mb
function webinar_mb($meta_boxes)
{
$prefix = "";
$webinar = new_cmb2_box(array('id' => 'webinar-data', 'title' => 'Webinar Details', 'object_types' => array('citrix_webinar'), 'show_on' => array(), 'context' => 'side', 'priority' => 'default', 'show_names' => true));
$webinar->add_field(array('name' => 'Webinar Key', 'id' => $prefix . 'webinar_key', 'type' => 'text', 'default' => get_old_webinar_key(), 'options' => array()));
$webinar->add_field(array('name' => 'PDF Url', 'id' => $prefix . 'webinar_pdf', 'type' => 'file', 'default' => get_old_pdf_value(), 'options' => array()));
}
开发者ID:eliseoeric,项目名称:citrix-connect,代码行数:7,代码来源:webinar_mb.php
示例3: fields
/**
* Add custom fields to the CPT
*
* @since 0.1.0
* @return void
*/
public function fields()
{
$prefix = 'wds_announcements_';
$cmb = new_cmb2_box(array('id' => $prefix . 'metabox', 'title' => __('WDS Announcements Meta Box', 'wds-announcements'), 'object_types' => array('wds-announcements'), 'context' => 'normal', 'priority' => 'high'));
// Regular text field
$cmb->add_field(array('name' => __('Link URL', 'cmb2'), 'desc' => __('(optional) e.g. http://www.lifehacker.com', 'cmb2'), 'id' => $prefix . 'url', 'type' => 'text_url'));
}
开发者ID:WebDevStudios,项目名称:WDS-Announcements,代码行数:13,代码来源:class-announcements-cpt.php
示例4: register_metabox
/**
* Add the metabox
* @since 0.1.0
*/
public function register_metabox()
{
// Start with an underscore to hide fields from custom fields list
$prefix = '_wds_ratings_';
$cmb = new_cmb2_box(array('id' => $prefix . 'metabox', 'title' => __('WDS Ratings', 'wds_ratings'), 'object_types' => array('page', 'post'), 'context' => 'side', 'show_names' => false));
$cmb->add_field(array('desc' => $this->filter_label(), 'id' => $prefix . 'filter', 'type' => 'checkbox'));
}
开发者ID:xscript,项目名称:WDS-Ratings,代码行数:11,代码来源:meta-box.php
示例5: ht_kb_voting_meta_boxes
/**
* Register meta boxes
* @uses the meta-boxes module
*/
function ht_kb_voting_meta_boxes()
{
$prefix = '_ht_voting_';
$voting_metabox = new_cmb2_box(array('id' => $prefix . 'metabox', 'title' => __('Voting Options', 'ht-knowledge-base'), 'object_types' => array('ht_kb'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true));
//dummy to upgrade fields
$voting_metabox->add_field(array('name' => 'update_dummy', 'id' => $prefix . 'updade_dummy', 'type' => 'title', 'show_on_cb' => array($this, 'maybe_upgrade_meta_fields')));
//voting enable
$voting_metabox->add_field(array('name' => __('Disable Voting', 'ht-knowledge-base'), 'description' => __('Disable voting on this article', 'ht-knowledge-base'), 'id' => $prefix . 'voting_disabled', 'type' => 'checkbox', 'show_on_cb' => array($this, 'cmb_only_show_for_voting_enabled')));
/*
//voting reset - no longer used - see ht-voting-backend instead
$voting_metabox->add_field( array(
'name' => __( 'Reset Voting', 'ht-knowledge-base' ),
'description' => __( 'Check this box to reset all votes for this article on update', 'ht-knowledge-base' ),
'id' => $prefix .'voting_reset',
'type' => 'checkbox',
'default' => false,
'sanitization_cb' => array( $this, 'santize_reset_field' ),
'show_on_cb' => array( $this, 'cmb_only_show_for_votes' ),
) );
*/
//voting reset confirmation
$voting_metabox->add_field(array('name' => __('No Votes', 'ht-knowledge-base'), 'description' => __('There are currently no votes or votes have been reset', 'ht-knowledge-base'), 'id' => $prefix . 'voting_reset_confirm', 'type' => 'checkbox', 'default' => true, 'sanitization_cb' => array($this, 'santize_reset_confirm_field'), 'show_on_cb' => array($this, 'cmb_only_show_for_no_votes')));
//usefulness
$voting_metabox->add_field(array('name' => __('Usefulness', 'ht-knowledge-base'), 'description' => __('Set the usefulness for this article (editing may cause inconsistencies with voting)', 'ht-knowledge-base'), 'id' => '_ht_kb_usefulness', 'type' => 'text'));
}
开发者ID:jamestrevorlees,项目名称:odd-web-v1.00,代码行数:29,代码来源:ht-voting-meta-boxes.php
示例6: anp_meetings_add_proposal_metabox
function anp_meetings_add_proposal_metabox()
{
$cmb = new_cmb2_box(array('id' => 'proposal-detail-page', 'title' => __('Proposal Detail Page', 'meeting'), 'object_types' => array('proposal'), 'context' => 'side', 'priority' => 'high'));
$cmb->add_field(array('name' => __('Status', 'meeting'), 'id' => 'proposal_status', 'type' => 'taxonomy_select', 'taxonomy' => 'proposal_status', 'attributes' => array('required' => 'required')));
$cmb->add_field(array('name' => __('Date Accepted', 'meeting'), 'id' => 'meeting_date', 'type' => 'text_date'));
$cmb->add_field(array('name' => __('Date Effective', 'meeting'), 'id' => 'proposal_date_effective', 'type' => 'text_date'));
}
开发者ID:glocalcoop,项目名称:anp-meetings,代码行数:7,代码来源:custom-fields.php
示例7: cmb2_tb_metaboxes
function cmb2_tb_metaboxes()
{
// Start with an underscore to hide fields from custom fields list
$prefix = 'my_meta_';
/**
* Initiate the metabox
*/
$tb_boxes = new_cmb2_box(array('id' => 'contact_info', 'title' => __('Contact info', 'cmb2'), 'object_types' => array('tablebookings'), 'type' => 'text', 'context' => 'normal', 'priority' => 'high', 'show_names' => true));
// Booking Name
$tb_boxes->add_field(array('name' => __('Contact Name', 'cmb2'), 'desc' => __('Contact Name', 'cmb2'), 'id' => $prefix . 'name', 'type' => 'text'));
// Email text field
$tb_boxes->add_field(array('name' => __('Email', 'cmb2'), 'desc' => __('Email Address', 'cmb2'), 'object_types' => array('tablebookings'), 'id' => $prefix . 'email', 'type' => 'text_email'));
// Booking Phone no.
$tb_boxes->add_field(array('name' => __('Phone', 'cmb2'), 'desc' => __('Phone Number', 'cmb2'), 'id' => $prefix . 'phone', 'type' => 'text'));
$tb_boxes2 = new_cmb2_box(array('id' => 'company_info', 'title' => __('Company info', 'cmb2'), 'object_types' => array('tablebookings'), 'type' => 'text', 'context' => 'normal', 'priority' => 'high', 'show_names' => true));
// Company Name
$tb_boxes2->add_field(array('name' => __('Company Name', 'cmb2'), 'id' => $prefix . 'companyname', 'type' => 'text'));
// Company Address
$tb_boxes2->add_field(array('name' => __('Company Address', 'cmb2'), 'id' => $prefix . 'companyaddress', 'type' => 'text'));
$tb_boxes3 = new_cmb2_box(array('id' => 'Booking_info', 'title' => __('Booking info', 'cmb2'), 'object_types' => array('tablebookings'), 'type' => 'text', 'context' => 'normal', 'priority' => 'high', 'show_names' => true));
// Number of delegates
$tb_boxes3->add_field(array('name' => __('Number of Delegates', 'cmb2'), 'id' => $prefix . 'delenum', 'type' => 'text'));
// Delegate 1 first and last names
$tb_boxes3->add_field(array('name' => __('Delegate 1 - First Name', 'cmb2'), 'id' => $prefix . 'd1firstname', 'type' => 'text'));
$tb_boxes3->add_field(array('name' => __('Delegate 1 - Second Name', 'cmb2'), 'id' => $prefix . 'd1secondname', 'type' => 'text'));
// Delegate 2 first and last names
$tb_boxes3->add_field(array('name' => __('Delegate 2 - First Name', 'cmb2'), 'id' => $prefix . 'd2firstname', 'type' => 'text'));
$tb_boxes3->add_field(array('name' => __('Delegate 2 - Second Name', 'cmb2'), 'id' => $prefix . 'd2secondname', 'type' => 'text'));
// Delegate 3 first and last names
$tb_boxes3->add_field(array('name' => __('Delegate 3 - First Name', 'cmb2'), 'id' => $prefix . 'd3firstname', 'type' => 'text'));
$tb_boxes3->add_field(array('name' => __('Delegate 3 - Second Name', 'cmb2'), 'id' => $prefix . 'd3secondname', 'type' => 'text'));
// Delegate 4 first and last names
$tb_boxes3->add_field(array('name' => __('Delegate 4 - First Name', 'cmb2'), 'id' => $prefix . 'd4firstname', 'type' => 'text'));
$tb_boxes3->add_field(array('name' => __('Delegate 4 - Second Name', 'cmb2'), 'id' => $prefix . 'd4secondname', 'type' => 'text'));
// Delegate 5 first and last names
$tb_boxes3->add_field(array('name' => __('Delegate 5 - First Name', 'cmb2'), 'id' => $prefix . 'd5firstname', 'type' => 'text'));
$tb_boxes3->add_field(array('name' => __('Delegate 5 - Second Name', 'cmb2'), 'id' => $prefix . 'd5secondname', 'type' => 'text'));
// Delegate 6 first and last names
$tb_boxes3->add_field(array('name' => __('Delegate 6 - First Name', 'cmb2'), 'id' => $prefix . 'd6firstname', 'type' => 'text'));
$tb_boxes3->add_field(array('name' => __('Delegate 6 - Second Name', 'cmb2'), 'id' => $prefix . 'd6secondname', 'type' => 'text'));
// Delegate 7 first and last names
$tb_boxes3->add_field(array('name' => __('Delegate 7 - First Name', 'cmb2'), 'id' => $prefix . 'd7firstname', 'type' => 'text'));
$tb_boxes3->add_field(array('name' => __('Delegate 7 - Second Name', 'cmb2'), 'id' => $prefix . 'd7secondname', 'type' => 'text'));
// Delegate 8 first and last names
$tb_boxes3->add_field(array('name' => __('Delegate 8 - First Name', 'cmb2'), 'id' => $prefix . 'd8firstname', 'type' => 'text'));
$tb_boxes3->add_field(array('name' => __('Delegate 8 - Second Name', 'cmb2'), 'id' => $prefix . 'd8secondname', 'type' => 'text'));
// Delegate 9 first and last names
$tb_boxes3->add_field(array('name' => __('Delegate 9 - First Name', 'cmb2'), 'id' => $prefix . 'd9firstname', 'type' => 'text'));
$tb_boxes3->add_field(array('name' => __('Delegate 9 - Second Name', 'cmb2'), 'id' => $prefix . 'd9secondname', 'type' => 'text'));
// Delegate 10 first and last names
$tb_boxes3->add_field(array('name' => __('Delegate 10 - First Name', 'cmb2'), 'id' => $prefix . 'd10firstname', 'type' => 'text'));
$tb_boxes3->add_field(array('name' => __('Delegate 10 - Second Name', 'cmb2'), 'id' => $prefix . 'd10secondname', 'type' => 'text'));
$tb_boxes3->add_field(array('name' => __('Total cost', 'cmb2'), 'id' => $prefix . 'total_cost', 'type' => 'text'));
$tb_boxes3->add_field(array('name' => __('Paid', 'cmb2'), 'id' => $prefix . 'paid', 'type' => 'checkbox', 'default' => false));
$tb_boxes3->add_field(array('name' => __('Order ID', 'cmb2'), 'id' => $prefix . 'order_id', 'type' => 'text'));
// Order info
$tb_boxes4 = new_cmb2_box(array('id' => 'order_info', 'title' => __('Order info', 'cmb2'), 'object_types' => array('tablebookings'), 'show_on' => array('key' => 'id', 'value' => ''), 'type' => 'text', 'context' => 'normal', 'priority' => 'high', 'show_names' => true));
$tb_boxes4->add_field(array('name' => __('Password', 'cmb2'), 'id' => $prefix . 'password', 'type' => 'text'));
$tb_boxes4->add_field(array('name' => __('Response', 'cmb2'), 'id' => $prefix . 'response', 'type' => 'text'));
}
开发者ID:barrmull77,项目名称:tablebooker,代码行数:60,代码来源:tablebooker.php
示例8: trientamedik_register_product_metabox
function trientamedik_register_product_metabox()
{
$prefix = '_trientamedik_';
$cmb_product = new_cmb2_box(array('id' => $prefix . 'product', 'title' => __('Slide Details', 'trientamedik'), 'object_types' => array('product')));
$cmb_product->add_field(array('name' => __('Main Image', 'trientamedik'), 'desc' => __('Upload an image or enter a URL.', 'trientamedik'), 'id' => $prefix . 'product_image', 'type' => 'file'));
$cmb_product->add_field(array('name' => 'Project Image', 'desc' => '', 'id' => $prefix . 'product_image_list', 'type' => 'file_list'));
}
开发者ID:jrajalu,项目名称:trientamedik,代码行数:7,代码来源:theme-metabox.php
示例9: skillMetaBox
function skillMetaBox()
{
global $cmb_skill;
$cmb_skill_fields = new_cmb2_box(array('id' => $cmb_skill . 'meta', 'title' => __('Skill Information', 'cmb2'), 'object_types' => array('skill'), 'show_names' => true));
$cmb_skill_fields->add_field(array('name' => __('Skill Percentage', 'cmb2'), 'id' => $cmb_skill . 'meta_percentage', 'type' => 'text_small', 'attributes' => array('type' => 'number', 'min' => 1, 'max' => 100), 'after_field' => '%', 'default' => '1'));
$cmb_skill_fields->add_field(array('name' => __('Skill Percentage Color', 'cmb2'), 'id' => $cmb_skill . 'meta_percentage_color', 'type' => 'colorpicker', 'default' => '#6277b2'));
}
开发者ID:somratexel,项目名称:somrat_dot_me,代码行数:7,代码来源:exela-app-bootstrap.php
示例10: jpak_project_metaboxes
function jpak_project_metaboxes()
{
$prefix = '_jpak_project_';
// Project Details Box
$cmb = new_cmb2_box(array('id' => 'project_details', 'title' => __('Project Details', 'cmb2'), 'object_types' => array('jpak_project'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true));
// Project Subtitle
$cmb->add_field(array('name' => 'Subtitle', 'desc' => 'Displays on archive page entry hover. Ex: "Custom Genesis Child Theme"', 'id' => $prefix . 'subtitle', 'type' => 'text'));
// Color Picker
$cmb->add_field(array('name' => 'Project Color', 'desc' => __('Used in page background and button accent.', 'cmb2'), 'id' => $prefix . 'color', 'type' => 'colorpicker', 'default' => '#ffffff'));
// Full Image
$cmb->add_field(array('name' => 'Full Image', 'desc' => 'Recommended Width: 1200px', 'id' => $prefix . 'full_image', 'type' => 'file', 'options' => array('url' => false, 'add_upload_file_text' => 'Upload Image')));
// Desktop Preview
$cmb->add_field(array('name' => 'Desktop Preview Image', 'desc' => 'Recommended Size: 1100px x 700px.', 'id' => $prefix . 'desktop_preview', 'type' => 'file', 'options' => array('url' => false, 'add_upload_file_text' => 'Upload Image')));
// Mobile Preview
$cmb->add_field(array('name' => 'Mobile Preview Image', 'desc' => 'Recommended Size: 400px x 650px.', 'id' => $prefix . 'mobile_preview', 'type' => 'file', 'options' => array('url' => false, 'add_upload_file_text' => 'Upload Image')));
// Features
$cmb->add_field(array('name' => __('Features', 'cmb2'), 'id' => $prefix . 'features', 'type' => 'text', 'repeatable' => true));
// Live URL
$cmb->add_field(array('name' => __('Live Site URL', 'cmb2'), 'desc' => __('For button if project type is "Website".', 'cmb2'), 'id' => $prefix . 'live_url', 'type' => 'text_url', 'protocols' => array('http', 'https')));
// Testimonial
$cmb->add_field(array('name' => 'Testimonial', 'desc' => 'Do not add quotation marks.', 'id' => $prefix . 'testimonial', 'type' => 'textarea_small'));
// Testimonial Name
$cmb->add_field(array('name' => 'Testimonial Name', 'desc' => 'Ex: "Jimbo Fisher"', 'id' => $prefix . 'testimonial_name', 'type' => 'text'));
// Testimonial Occupation
$cmb->add_field(array('name' => 'Testimonial Occupation', 'desc' => 'Ex: "Head Football Coach, USF"', 'id' => $prefix . 'testimonial_occupation', 'type' => 'text'));
}
开发者ID:JordanPak,项目名称:JordanPak-Functionality,代码行数:26,代码来源:project.php
示例11: cmb2_magicsuggest_metaboxes_example
/**
* Define the metabox and field configurations.
*
* @param array $meta_boxes
* @return array
*/
function cmb2_magicsuggest_metaboxes_example()
{
$prefix = '_cmb2_magicsuggest_demo_';
$example_meta = new_cmb2_box(array('id' => $prefix . 'metabox', 'title' => __('cmb2-magicsuggest-field demo', 'cmb2'), 'object_types' => array('page'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true));
$example_meta->add_field(array('name' => __('Grab some fruits', 'cmb2'), 'desc' => __('Enter up to 6 fruits.', 'cmb2'), 'id' => $prefix . 'fruits', 'type' => 'magicsuggest', 'options' => array('data' => array('Banana', 'Apple', 'Orange', 'Lemon', 'Kiwi'), 'allow_free_entries' => true, 'max_selection' => 6), 'attributes' => array('placeholder' => 'Add or grab some fruit here')));
$example_meta->add_field(array('name' => __('Related Posts', 'cmb2'), 'desc' => __('Add related posts', 'cmb2'), 'id' => $prefix . 'related_posts', 'type' => 'magicsuggest', 'options' => array('data' => get_some_posts_data(), 'expand_on_focus' => true, 'allow_free_entries' => false, 'value_field' => 'post_id', 'display_field' => 'post_title'), 'attributes' => array('placeholder' => 'Enter a related post title here..')));
}
开发者ID:eliottparis,项目名称:cmb2-magicsuggest-field,代码行数:13,代码来源:example-field-setup.php
示例12: mbdb_book_grid_meta_boxes
function mbdb_book_grid_meta_boxes()
{
$mbdb_book_grid_metabox = new_cmb2_box(array('id' => 'mbdb_book_grid_metabox', 'title' => __('Book Grid Settings', 'mooberry-book-manager'), 'object_types' => array('page'), 'context' => 'normal', 'priority' => 'default', 'show_names' => true));
$mbdb_book_grid_metabox->add_field(array('name' => __('Display Books on This Page?', 'mooberry-book-manager'), 'id' => '_mbdb_book_grid_display', 'type' => 'select', 'default' => 'no', 'options' => array('yes' => __('Yes', 'mooberry-book-manager'), 'no' => __('No', 'mooberry-book-manager'))));
$mbdb_book_grid_metabox->add_field(array('name' => __('Books to Display', 'mooberry-book-manager'), 'id' => '_mbdb_book_grid_books', 'type' => 'select', 'options' => mbdb_book_grid_selection_options()));
$mbdb_book_grid_metabox->add_field(array('name' => __('Select Books', 'mooberry-book-manager'), 'id' => '_mbdb_book_grid_custom', 'type' => 'multicheck', 'options' => mbdb_get_book_array()));
$mbdb_book_grid_metabox->add_field(array('name' => __('Select Genres', 'mooberry-book-manager'), 'id' => '_mbdb_book_grid_genre', 'type' => 'multicheck', 'options' => mbdb_get_term_options('mbdb_genre')));
$mbdb_book_grid_metabox->add_field(array('name' => __('Select Series', 'mooberry-book-manager'), 'id' => '_mbdb_book_grid_series', 'type' => 'multicheck', 'options' => mbdb_get_term_options('mbdb_series')));
$mbdb_book_grid_metabox->add_field(array('name' => __('Select Tags', 'mooberry-book-manager'), 'id' => '_mbdb_book_grid_tag', 'type' => 'multicheck', 'options' => mbdb_get_term_options('mbdb_tag')));
$mbdb_book_grid_metabox->add_field(array('name' => __('Select Publishers', 'mooberry-book-manager'), 'id' => '_mbdb_book_grid_publisher', 'type' => 'multicheck', 'options' => mbdb_get_publishers('no')));
$mbdb_book_grid_metabox->add_field(array('name' => __('Select Editors', 'mooberry-book-manager'), 'id' => '_mbdb_book_grid_editor', 'type' => 'multicheck', 'options' => mbdb_get_term_options('mbdb_editor')));
$mbdb_book_grid_metabox->add_field(array('name' => __('Select Illustrators', 'mooberry-book-manager'), 'id' => '_mbdb_book_grid_illustrator', 'type' => 'multicheck', 'options' => mbdb_get_term_options('mbdb_illustrator')));
$mbdb_book_grid_metabox->add_field(array('name' => __('Select Cover Artists', 'mooberry-book-manager'), 'id' => '_mbdb_book_grid_cover_artist', 'type' => 'multicheck', 'options' => mbdb_get_term_options('mbdb_cover_artist')));
$group_by_options = mbdb_book_grid_group_by_options();
$count = count($group_by_options);
for ($x = 1; $x < $count; $x++) {
$mbdb_book_grid_metabox->add_field(array('name' => __('Group Books By', 'mooberry-book-manager'), 'id' => '_mbdb_book_grid_group_by_level_' . $x, 'type' => 'select', 'options' => $group_by_options));
// put a warning at the 5th level
if ($x == 5) {
$mbdb_book_grid_metabox->add_field(array('name' => __('Warning: Setting more than 5 levels could cause the page to timeout and not display.', 'mooberry-book-manager'), 'type' => 'title', 'id' => '_mbdb_book_grid_warning', 'attributes' => array('display' => 'none')));
}
}
$mbdb_book_grid_metabox->add_field(array('name' => __('Order By', 'mooberry-book-manager'), 'id' => '_mbdb_book_grid_order', 'type' => 'select', 'options' => mbdb_book_grid_order_options()));
$mbdb_book_grid_metabox->add_field(array('name' => __('Use default cover height?', 'mooberry-book-manager'), 'id' => '_mbdb_book_grid_cover_height_default', 'type' => 'select', 'default' => 'yes', 'options' => array('yes' => __('Yes', 'mooberry-book-manager'), 'no' => __('No', 'mooberry-book-manager'))));
$mbdb_book_grid_metabox->add_field(array('name' => __('Book Cover Height (px)', 'mooberry-book-manager'), 'id' => '_mbdb_book_grid_cover_height', 'type' => 'text_small', 'attributes' => array('type' => 'number', 'pattern' => '\\d*', 'min' => 50)));
$mbdb_book_grid_metabox->add_field(array('name' => __('Additional Content (bottom)', 'mooberry-book-manager'), 'id' => '_mbdb_book_grid_description_bottom', 'type' => 'wysiwyg', 'description' => __('This displays under the book grid.', 'mooberry-book-manager'), 'options' => array('wpautop' => true, 'media_buttons' => true, 'textarea_rows' => 10, 'tabindex' => '', 'editor_css' => '', 'editor_class' => '', 'teeny' => false, 'dfw' => false, 'tinymce' => true, 'quicktags' => true)));
$mbdb_book_grid_metabox = apply_filters('mbdb_book_grid_meta_boxes', $mbdb_book_grid_metabox);
}
开发者ID:joeytwiddle,项目名称:Mooberry-Book-Manager,代码行数:28,代码来源:book-grid.php
示例13: add_fields
/**
* Add the options metabox to the array of metaboxes
* @since 0.1.0
*/
public static function add_fields()
{
// hook in our save notices
$container = new_cmb2_box(array('id' => 'vsi_fields_products', 'title' => 'Informações VSI Gestão', 'object_types' => array('product'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true));
// Set our CMB2 field
$container->add_field(array('name' => __('ID de Produtos ', 'vinhasoft'), 'desc' => __('ID dos Produtos na base do VSI Gestão', 'vinhasoft'), 'id' => 'vsigestao_product_id', 'type' => 'text', 'default' => '', 'attributes' => array('required' => 'required', 'readonly' => 'readonly')));
}
开发者ID:shankarnakai,项目名称:gbdesign,代码行数:11,代码来源:Produto.php
示例14: myxon_register_service_metabox
function myxon_register_service_metabox()
{
$prefix = '_myxon_';
$cmb_service = new_cmb2_box(array('id' => $prefix . 'service', 'title' => __('Service Details', 'myxon'), 'object_types' => array('service')));
$cmb_service->add_field(array('name' => __('Main Image', 'myxon'), 'desc' => __('Upload an image or enter a URL.', 'myxon'), 'id' => $prefix . 'service_image', 'type' => 'file'));
$cmb_service->add_field(array('name' => 'Project Image', 'desc' => '', 'id' => $prefix . 'service_image_list', 'type' => 'file_list'));
}
开发者ID:jrajalu,项目名称:myxon,代码行数:7,代码来源:theme-metabox.php
示例15: page_mb
function page_mb($meta_boxes)
{
$prefix = "_WW_";
$page_options = new_cmb2_box(array('id' => 'page_options', 'title' => 'Page Options', 'object_types' => array('page'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true));
$page_options->add_field(array('id' => $prefix . 'header_class', 'name' => 'Page header class', 'description' => 'Add any clases you would like added to the .page_header here.', 'type' => 'text'));
$page_options->add_field(array('id' => $prefix . 'content_class', 'name' => 'Content class', 'description' => 'Add any clases you would like added to the .entry-content here.', 'type' => 'text'));
}
开发者ID:eliseoeric,项目名称:woodys_waterfront,代码行数:7,代码来源:page_mb.php
示例16: banner_mb
function banner_mb($meta_boxes)
{
$prefix = "_WW_";
$banners = array('promo-gc-blue' => 'Promo Gift Cert Blue', 'promo-hh-blue' => 'Promo Happy Hour Blue', 'promo-hh-green' => 'Promo Happy Hour Green', 'review-two-column' => 'Review Columns (2)');
$banner_config = new_cmb2_box(array('id' => 'banner_config', 'title' => 'Banner Config', 'object_types' => array('page'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true));
$banner_config->add_field(array('name' => 'Banner', 'desc' => 'Select an banner to display', 'id' => $prefix . 'banner_type', 'type' => 'select', 'show_option_none' => true, 'default' => '', 'options' => $banners));
}
开发者ID:eliseoeric,项目名称:woodys_waterfront,代码行数:7,代码来源:banner_mb.php
示例17: tpcvendors_register_additional_content_metabox
/**
* Build metabox and input fields for additional content
*
* @return void
*/
function tpcvendors_register_additional_content_metabox()
{
// Start with an underscore to hide fields from custom fields list
$prefix = '_tpcvendors_additional_content_';
/**
* Set Up Metabox
*/
$cmb_additonal_content = new_cmb2_box(array('id' => $prefix . 'metabox', 'title' => __('Additional Content', 'cmb2'), 'object_types' => array('vendor'), 'context' => 'normal', 'priority' => 'high'));
/**
* Additional Content Sections
*
* Type: Repeatable Group
*/
$group_field_id = $cmb_additonal_content->add_field(array('id' => $prefix . 'group', 'type' => 'group', 'description' => __('Add more content sections as needed', 'cmb2'), 'options' => array('group_title' => __('Additional Content Section {#}', 'cmb2'), 'add_button' => __('Add Content Section', 'cmb2'), 'remove_button' => __('Remove Content Section', 'cmb2'), 'sortable' => true)));
/**
* Section Title
*
* Type: Text Field
*/
$cmb_additonal_content->add_group_field($group_field_id, array('name' => 'Section Title', 'id' => 'section_title', 'type' => 'text'));
/**
* Content
*
* Type: WYSIWYG
*
* @link https://codex.wordpress.org/Function_Reference/wp_editor For Information on editor_id() function
*/
$cmb_additonal_content->add_group_field($group_field_id, array('name' => 'Content', 'id' => 'content', 'type' => 'wysiwyg', 'options' => array('wpautop' => true, 'media_buttons' => true, 'tabindex' => '', 'editor_css' => '', 'editor_class' => '', 'teeny' => false, 'dfw' => false, 'tinymce' => true, 'quicktags' => true)));
}
开发者ID:joeyred,项目名称:tpc-vendors,代码行数:34,代码来源:more-content.php
示例18: do_meta_boxes
/**
* Handles the CMB2 boxes.
* @return void
*/
public function do_meta_boxes()
{
$cmb = new_cmb2_box(array('id' => $this->prefix . 'metabox', 'title' => esc_html(__('Frequently Asked Questions', 'wds-faq-page')), 'object_types' => array('page'), 'context' => 'normal', 'priority' => 'high', 'show_on' => array('key' => 'id', 'value' => $this->show_on())));
$group_field_id = $cmb->add_field(array('id' => $this->prefix . 'group', 'type' => 'group', 'options' => array('group_title' => esc_html__('Question #{#}', 'wds-faq-page'), 'add_button' => esc_html__('Add another question', 'wds-faq-page'), 'remove_button' => esc_html__('Remove question', 'wds-faq-page'), 'sortable' => true)));
$cmb->add_group_field($group_field_id, array('name' => esc_html__('Question', 'wds-faq-page'), 'id' => 'question', 'type' => 'text'));
$cmb->add_group_field($group_field_id, array('name' => esc_html__('Answer', 'wds-faq-page'), 'id' => 'answer', 'type' => 'textarea'));
}
开发者ID:jazzsequence,项目名称:WDS-FAQ-Page-,代码行数:11,代码来源:class-cmb.php
示例19: casanova_theme_register_metabox
/**
* Hook in and add a demo metabox. Can only happen on the 'cmb2_init' hook.
*/
function casanova_theme_register_metabox()
{
// Start with an underscore to hide fields from custom fields list
$prefix = '_cmb_';
$post_page_metabox = new_cmb2_box(array('id' => $prefix . 'post-page-meta', 'title' => __('Post/Page Settings', 'cmb2'), 'object_types' => array('post', 'page'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true));
$post_page_metabox->add_field(array('name' => __('Hide Title', 'cmb2'), 'desc' => __('This simply hide post or page title in front-end area.', 'cmb2'), 'id' => $prefix . 'hide_title', 'type' => 'checkbox'));
}
开发者ID:ryscript,项目名称:Scinttek-Decade-Project,代码行数:10,代码来源:init.php
示例20: yourprefix_register_conditionals_demo_metabox
/**
* Hook in and add a demo metabox. Can only happen on the 'cmb2_init' hook.
*/
function yourprefix_register_conditionals_demo_metabox()
{
// Start with an underscore to hide fields from custom fields list.
$prefix = '_yourprefix_conditions_demo_';
/**
* Sample metabox to demonstrate the different conditions you can set.
*/
$cmb_demo = new_cmb2_box(array('id' => $prefix . 'metabox', 'title' => 'Test Metabox', 'object_types' => array('page')));
$cmb_demo->add_field(array('name' => 'Address', 'desc' => 'Write down an address for showing the other address options', 'id' => $prefix . 'address', 'type' => 'text'));
$cmb_demo->add_field(array('name' => 'Zipcode', 'id' => $prefix . 'zipcode', 'type' => 'text_medium', 'attributes' => array('required' => true, 'data-conditional-id' => $prefix . 'address')));
$cmb_demo->add_field(array('name' => 'Country', 'id' => $prefix . 'country', 'type' => 'text_medium', 'attributes' => array('required' => true, 'data-conditional-id' => $prefix . 'address')));
$cmb_demo->add_field(array('name' => 'Checkbox', 'id' => $prefix . 'checkbox', 'type' => 'checkbox'));
$cmb_demo->add_field(array('name' => 'Show if checked', 'id' => $prefix . 'show_if_checked', 'type' => 'text', 'attributes' => array('data-conditional-id' => $prefix . 'checkbox')));
$cmb_demo->add_field(array('name' => 'Show if unchecked', 'id' => $prefix . 'show_if_unchecked', 'type' => 'text', 'attributes' => array('data-conditional-id' => $prefix . 'checkbox', 'data-conditional-value' => 'off')));
$cmb_demo->add_field(array('name' => 'Reason', 'id' => $prefix . 'reason', 'type' => 'select', 'show_option_none' => true, 'options' => array('one' => 'Reason 1', 'two' => 'Reason 2', 'three' => 'Reason 3', 'other' => 'Other reason')));
$cmb_demo->add_field(array('name' => 'Other reason detail', 'desc' => 'Write down the reason', 'id' => $prefix . 'other_reason_detail', 'type' => 'textarea', 'attributes' => array('required' => true, 'data-conditional-id' => $prefix . 'reason', 'data-conditional-value' => 'other')));
$cmb_demo->add_field(array('name' => 'Reason 2', 'id' => $prefix . 'reason_2', 'type' => 'select', 'show_option_none' => true, 'options' => array('one' => 'Reason 1', 'two' => 'Reason 2', 'three' => 'Reason 3', 'other_price' => 'Other reason based on the price', 'other_quality' => 'Other reason based on the quality')));
$cmb_demo->add_field(array('name' => 'Other reason detail', 'desc' => 'Write down the reason', 'id' => $prefix . 'other_reason_detail_2', 'type' => 'textarea', 'attributes' => array('required' => true, 'data-conditional-id' => $prefix . 'reason_2', 'data-conditional-value' => wp_json_encode(array('other_price', 'other_quality')))));
$cmb_demo->add_field(array('name' => 'Sizes', 'id' => $prefix . 'sizes', 'type' => 'radio', 'show_option_none' => true, 'options' => array('xs' => 'XS', 's' => 'S', 'm' => 'M', 'l' => 'L', 'xl' => 'XL', 'custom' => 'Custom'), 'attributes' => array('required' => 'required')));
$cmb_demo->add_field(array('name' => 'Custom description', 'desc' => 'Write a description for your custom size', 'id' => $prefix . 'size_custom_description', 'type' => 'textarea', 'required' => true, 'attributes' => array('required' => true, 'data-conditional-id' => $prefix . 'sizes', 'data-conditional-value' => 'custom')));
// Example using conditionals with multi-check checkboxes.
$cmb_demo->add_field(array('name' => __('Test Multi Checkbox', 'cmb2'), 'desc' => __('field description (optional)', 'cmb2'), 'id' => $prefix . 'multi-checkbox', 'type' => 'multicheck', 'options' => array('check1' => __('Check One', 'cmb2'), 'check2' => __('Check Two', 'cmb2'), 'check3' => __('Check Three', 'cmb2'))));
$cmb_demo->add_field(array('name' => 'Multi-check: Shown if *any* checkbox is checked', 'id' => $prefix . 'multi-check-detail-test-no-value', 'type' => 'text', 'attributes' => array('required' => true, 'data-conditional-id' => $prefix . 'multi-checkbox')));
$cmb_demo->add_field(array('name' => 'Multi-check: Only shown if checkbox 2 is checked', 'id' => $prefix . 'multi-check-detail-test-string', 'type' => 'text', 'attributes' => array('data-conditional-id' => $prefix . 'multi-checkbox', 'data-conditional-value' => 'check2')));
$cmb_demo->add_field(array('name' => 'Multi-check : Shown if either checkbox 1 *or* 3 is checked', 'id' => $prefix . 'multi-check-detail-test-array', 'type' => 'text', 'attributes' => array('data-conditional-id' => $prefix . 'multi-checkbox', 'data-conditional-value' => wp_json_encode(array('check1', 'check3')))));
// Example conditionals within a group.
$group_id = $cmb_demo->add_field(array('id' => $prefix . 'repeatable-group', 'type' => 'group', 'description' => 'Repeatable group', 'options' => array('group_title' => 'Entry {#}', 'add_button' => 'Add Another Entry', 'remove_button' => 'Remove Entry', 'sortable' => true)));
$cmb_demo->add_group_field($group_id, array('name' => 'Checkbox in group', 'id' => 'checkbox', 'type' => 'checkbox'));
$cmb_demo->add_group_field($group_id, array('name' => 'Dependant field', 'id' => 'dependant', 'type' => 'text_small', 'attributes' => array('required' => true, 'data-conditional-id' => wp_json_encode(array($group_id, 'checkbox')), 'data-conditional-value' => 'on')));
}
开发者ID:jrfnl,项目名称:cmb2-conditionals,代码行数:33,代码来源:example-functions.php
注:本文中的new_cmb2_box函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论