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'))); }
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())); }
/** * 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')); }
/** * 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')); }
/** * 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')); }
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')); }
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')); }
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')); }
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')); }
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')); }
/** * 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..'))); }
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); }
/** * 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'))); }
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')); }
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')); }
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)); }
/** * 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))); }
/** * 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')); }
/** * 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')); }
/** * 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'))); }
function edgimo_register_reservation_metabox() { $prefix = '_reservation_'; $temp = get_posts(array('post_type' => 'activity', 'posts_per_page' => -1)); $activities = array(); foreach ($temp as $p) { $activities[$p->ID] = AC::get_activity_backend_title($p->ID); } $cmb = new_cmb2_box(array('id' => $prefix . 'metabox', 'title' => __('Basic Registration Info', 'cmb2'), 'object_types' => array('reservation'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true)); $cmb->add_field(array('name' => __('Activity', 'cmb2'), 'desc' => __('Activity for which this registration was made', 'cmb2'), 'id' => $prefix . 'activity', 'type' => 'select', 'options' => $activities)); $cmb->add_field(array('name' => __('Registrant Count', 'cmb2'), 'desc' => __('Number of seats registered', 'cmb2'), 'id' => $prefix . 'registrant_count', 'type' => 'text', 'attributes' => array('required' => 'required'))); $cmb->add_field(array('name' => __('Opt-In', 'cmb2'), 'desc' => __('Registrant opted in for e-mail alerts and Twitter follow', 'cmb2'), 'id' => $prefix . 'optin', 'type' => 'radio_inline', 'options' => array('yes' => 'Yes', 'no' => 'No'))); $cmb2 = new_cmb2_box(array('id' => $prefix . 'metabox2', 'title' => __('Registrants', 'cmb2'), 'object_types' => array('reservation'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true)); $registrant_group_id = $cmb2->add_field(array('id' => $prefix . 'registrant_group', 'type' => 'group', 'description' => __('The first registrant is the primary registrant', 'cmb'), 'options' => array('group_title' => __('Registrant', 'cmb'), 'add_button' => __('Add Another Registrant', 'cmb'), 'remove_button' => __('Remove Registrant', 'cmb'), 'sortable' => true))); $cmb2->add_group_field($registrant_group_id, array('name' => 'First Name', 'id' => 'first_name', 'type' => 'text')); $cmb2->add_group_field($registrant_group_id, array('name' => 'Last Name', 'id' => 'last_name', 'type' => 'text')); $cmb2->add_group_field($registrant_group_id, array('name' => 'Email', 'id' => 'email', 'type' => 'text_email')); $cmb3 = new_cmb2_box(array('id' => $prefix . 'metabox3', 'title' => __('Purchased Add-ons', 'cmb2'), 'object_types' => array('reservation'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true)); $addon_group_id = $cmb3->add_field(array('id' => $prefix . 'addon_group', 'type' => 'group', 'description' => __('List of add-ons the registrant purchased', 'cmb'), 'options' => array('group_title' => __('Add-on', 'cmb'), 'add_button' => __('Add Another Add-on', 'cmb'), 'remove_button' => __('Remove Add-on', 'cmb'), 'sortable' => true))); $cmb3->add_group_field($addon_group_id, array('name' => 'Name', 'id' => 'title', 'type' => 'text')); $cmb3->add_group_field($addon_group_id, array('name' => 'Purchase Price', 'id' => 'cost', 'type' => 'text_money')); $cmb3->add_group_field($addon_group_id, array('name' => 'Quantity', 'id' => 'quantity', 'type' => 'text')); $cmb5 = new_cmb2_box(array('id' => $prefix . 'metabox5', 'title' => __('Billing Info', 'cmb2'), 'object_types' => array('reservation'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true)); $cmb5->add_field(array('name' => __('First Name', 'cmb2'), 'desc' => __('', 'cmb2'), 'id' => $prefix . 'billing_first_name', 'type' => 'text')); $cmb5->add_field(array('name' => __('Last Name', 'cmb2'), 'desc' => __('', 'cmb2'), 'id' => $prefix . 'billing_last_name', 'type' => 'text')); $cmb5->add_field(array('name' => __('Phone', 'cmb2'), 'desc' => __('', 'cmb2'), 'id' => $prefix . 'billing_phone', 'type' => 'text')); $cmb5->add_field(array('name' => __('Address', 'cmb2'), 'desc' => __('', 'cmb2'), 'id' => $prefix . 'billing_address', 'type' => 'text')); $cmb5->add_field(array('name' => __('City', 'cmb2'), 'desc' => __('', 'cmb2'), 'id' => $prefix . 'billing_city', 'type' => 'text')); $cmb5->add_field(array('name' => __('State', 'cmb2'), 'desc' => __('', 'cmb2'), 'id' => $prefix . 'billing_state', 'type' => 'select', 'options' => AC::$states)); $cmb5->add_field(array('name' => __('Zip', 'cmb2'), 'desc' => __('', 'cmb2'), 'id' => $prefix . 'billing_zip', 'type' => 'text')); $cmb5->add_field(array('name' => __('Transaction ID', 'cmb2'), 'desc' => __('', 'cmb2'), 'id' => $prefix . 'transaction_id', 'type' => 'text')); $cmb5->add_field(array('name' => __('Auth Code', 'cmb2'), 'desc' => __('', 'cmb2'), 'id' => $prefix . 'auth_code', 'type' => 'text')); $cmb5->add_field(array('name' => __('Notes', 'cmb2'), 'desc' => __('Enter any notes, visible only to admins', 'cmb2'), 'id' => $prefix . 'notes', 'type' => 'textarea')); }
/** * Define the metabox and field configurations. */ function blf_home_metaboxes() { // Start with an underscore to hide fields from custom fields list $prefix = '_blf_'; /** * Initiate the metabox */ $cmb = new_cmb2_box(array('id' => 'blf_metabox', 'title' => __('BLF Metabox', 'cmb2'), 'object_types' => array('page'), 'show_on' => array('key' => 'page-template', 'value' => 'templates/home.php'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true)); // Add other metaboxes as needed // home img break quote $cmb->add_field(array('name' => 'Home quote one', 'desc' => 'field description (optional)', 'id' => $prefix . 'home_quote', 'type' => 'textarea')); //home img background quote one $cmb->add_field(array('name' => 'Home quote bkg', 'desc' => 'field description (optional)', 'id' => $prefix . 'home_image', 'type' => 'file')); //home learn more button group $group_field_id = $cmb->add_field(array('id' => $prefix . 'home_learn_more', 'type' => 'group', 'description' => __('Generates reusable form entries', 'cmb2'), 'options' => array('group_title' => __('Entry {#}', 'cmb2'), 'add_button' => __('Add Another Entry', 'cmb2'), 'remove_button' => __('Remove Entry', 'cmb2'), 'sortable' => true))); // Id's for group's fields only need to be unique for the group. Prefix is not needed. $cmb->add_group_field($group_field_id, array('name' => 'Entry Title', 'id' => 'title', 'type' => 'text')); $cmb->add_group_field($group_field_id, array('name' => 'Description', 'description' => 'Write a short description for this entry', 'id' => 'description', 'type' => 'textarea_small')); $cmb->add_group_field($group_field_id, array('name' => 'Entry Image', 'id' => 'image', 'type' => 'file')); $cmb->add_group_field($group_field_id, array('name' => 'Button', 'id' => 'button', 'type' => 'textarea_code')); // home img break quote two $cmb->add_field(array('name' => 'Home quote two', 'desc' => 'field description (optional)', 'id' => $prefix . 'home_quote_two', 'type' => 'textarea')); //home img background quote two $cmb->add_field(array('name' => 'Home quote bkg two', 'desc' => 'field description (optional)', 'id' => $prefix . 'home_image_two', 'type' => 'file')); }
function create_metaboxes() { global $owl_settings; $carousel_metabox = new_cmb2_box(array('id' => 'wp_owl_metabox', 'title' => esc_html__('Owl Carousel', 'crystalskull'), 'object_types' => array('wp_owl'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true, 'closed' => false)); $categories = get_categories(array('type' => 'post', 'child_of' => 0, 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 1, 'hierarchical' => 1, 'taxonomy' => 'category', 'pad_counts' => false)); $cats[0] = esc_html__('None', 'crystalskull'); $cats[999] = esc_html__('All posts', 'crystalskull'); foreach ($categories as $cat) { $cats[$cat->cat_ID] = $cat->cat_name; } if (!isset($cats)) { $cats = ''; } $carousel_metabox->add_field(array('name' => esc_html__('Posts', 'crystalskull'), 'desc' => esc_html__('Choose post category you want to display', 'crystalskull'), 'id' => self::prefix . 'post_cat', 'type' => 'select', 'default' => 'none', 'options' => $cats)); $carousel_metabox->add_field(array('name' => esc_html__('Images', 'crystalskull'), 'desc' => esc_html__('Images to use', 'crystalskull'), 'id' => self::prefix . 'images', 'type' => 'file_list')); $image_sizes = get_intermediate_image_sizes(); $carousel_metabox->add_field(array('name' => esc_html__('Select size', 'crystalskull'), 'desc' => esc_html__('Select image size to use', 'crystalskull'), 'id' => self::prefix . 'image_size', 'type' => 'select', 'show_option_none' => false, 'default' => 'custom', 'options' => $image_sizes)); $carousel_metabox->add_field(array('name' => esc_html__('Rel attribute', 'crystalskull'), 'desc' => esc_html__('Used to open images in a lightbox, see the documentation of your lightbox plugin for this value', 'crystalskull'), 'default' => 'lightbox', 'type' => 'text', 'id' => self::prefix . 'rel')); $carousel_metabox->add_field(array('name' => esc_html__('Link to image size', 'crystalskull'), 'desc' => esc_html__('Generates link to specified image size', 'crystalskull'), 'type' => 'select', 'id' => self::prefix . 'link_to_size', 'options' => array_merge(array('none'), $image_sizes))); foreach ($owl_settings as $id => $setting) { if ($setting['cmb_type'] == 'checkbox') { $def = $this->set_checkbox_default($setting['default']); } else { $def = $setting['default']; } $carousel_metabox->add_field(array('name' => $setting['name'], 'description' => $setting['desc'], 'id' => self::prefix . $id, 'type' => $setting['cmb_type'], 'default' => $def)); } }
function partners_sub_page_metaboxes() { $prefix = '_partners_page_'; $options[0] = 'Please select...'; if (class_exists('RGFormsModel')) { foreach (RGFormsModel::get_forms(null, 'title') as $form) { $options[$form->id] = $form->title; } } /** * Initiate the metabox */ $cmb = new_cmb2_box(array('id' => 'partners_page_form_meta', 'title' => __('Partners Page Form', 'cmb2'), 'object_types' => array('page'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true, 'show_on' => array('key' => 'page-template', 'value' => 'templates/partners.php'))); // Regular text field $cmb->add_field(array('name' => __('Pick a Form', 'cmb2'), 'id' => $prefix . 'form_dropdown', 'type' => 'select', 'options' => $options)); /** * Initiate the metabox */ $cmb = new_cmb2_box(array('id' => 'partners_page_file_meta', 'title' => __('Partners Page File Downloads', 'cmb2'), 'object_types' => array('page'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true, 'show_on' => array('key' => 'page-template', 'value' => 'templates/partners.php'))); $group_field_id = $cmb->add_field(array('id' => 'partners_file_download_group', 'type' => 'group', 'options' => array('group_title' => __('File {#}', 'cmb2'), 'add_button' => __('Add Another File', 'cmb2'), 'remove_button' => __('Remove File', 'cmb2'), 'sortable' => true))); // Id's for group's fields only need to be unique for the group. Prefix is not needed. $cmb->add_group_field($group_field_id, array('name' => 'File Title', 'id' => 'title', 'type' => 'text')); $cmb->add_group_field($group_field_id, array('name' => 'File Upload', 'id' => 'link', 'type' => 'file')); $cmb->add_group_field($group_field_id, array('name' => 'File Image', 'id' => 'image', 'type' => 'file')); }
/** * Hook in and add a demo metabox. Can only happen on the 'cmb2_init' hook. */ function testimonial_register_metabox() { // get our options $options = Client_and_Product_Testimonials::get_cat_options(); // Start with an underscore to hide fields from custom fields list $prefix = '_testimonial_details_'; /** * Sample metabox to demonstrate each field type included * @since 0.1 */ $testimonial_metabox = new_cmb2_box(array('id' => $prefix . 'metabox', 'title' => sprintf(__('Linked %s', 'client-and-product-testimonials'), ucwords(str_replace('testimonial_', '', $options['_client_and_product_testimonial_taxonomy']))), 'object_types' => array('testimonial'), 'context' => 'normal', 'priority' => 'high')); /** * Add dynamic 'Star Rating' * @since 0.1 */ if ($options['_client_and_product_testimonial_enable_star_rating'] == '1') { $testimonial_metabox->add_field(array('name' => sprintf(__('Rating', 'client-and-product-testimonials')), 'desc' => sprintf(__('Set the rating for this testimonial.', 'client-and-product-testimonials'), $options['_client_and_product_testimonial_taxonomy']), 'id' => $prefix . 'testimonial_rating', 'type' => 'star_rating', 'default' => '5')); } /** * Add dynamic 'Association' field * @since 0.1 */ $testimonial_metabox->add_field(array('name' => sprintf(__('%s Associaton', 'client-and-product-testimonials'), ucwords(str_replace('testimonial_', '', $options['_client_and_product_testimonial_taxonomy']))), 'desc' => sprintf(__('Select which %s to assign this testimonial to.', 'client-and-product-testimonials'), str_replace('testimonial_', '', $options['_client_and_product_testimonial_taxonomy'])), 'id' => $prefix . 'testimonial_association', 'type' => 'taxonomy_select', 'show_option_none' => sprintf(__('No %s', 'client-and-product-testimonials'), ucwords(str_replace('testimonial_', '', rtrim($options['_client_and_product_testimonial_taxonomy'], 's')))), 'taxonomy' => str_replace('_', '-', $options['_client_and_product_testimonial_taxonomy']))); $testimonial_metabox->add_field(array('name' => __('Product/Client Association', 'client-and-product-testimonials'), 'desc' => __('This field should be hidden. If you are currently able to see it, we may have an issue.', 'client-and-product-testimonials'), 'id' => $prefix . 'testimonial_association_value', 'type' => 'testimonial_association_value')); /** * If 'testimonial_clients' is set, we should also display a 'position' input field * @since 0.1 */ if ('testimonial_clients' == $options['_client_and_product_testimonial_taxonomy']) { $testimonial_metabox->add_field(array('name' => __('Position at Company', 'client-and-product-testimonials'), 'desc' => __('Input this users position at the company assigned above.', 'client-and-product-testimonials'), 'id' => $prefix . 'client_position', 'type' => 'text', 'placeholder' => __('Product Manager', 'client-and-product-testimonials'))); } $testimonial_metabox->add_field(array('name' => __('Website', 'client-and-product-testimonials'), 'desc' => __('Input this users website to link back to.', 'client-and-product-testimonials'), 'id' => $prefix . 'url', 'type' => 'text_url', 'placeholder' => 'http://')); /** * Video Testimonial Details * @since 0.1 */ $video_testimonial_metabox = new_cmb2_box(array('id' => $prefix . 'video_testimonial_metabox', 'title' => __('Video Testimonial Details', 'client-and-product-testimonials') . ' <small>(' . __('pro', 'client-and-product-testimonials') . ')</small>', 'object_types' => array('testimonial'), 'context' => 'normal', 'priority' => 'high')); /* * Video Testimonial Checkbox */ $video_testimonial_metabox->add_field(array('name' => __('Enable Video Testimonial', 'client-and-product-testimonials'), 'desc' => sprintf(__('This is a video testimonial. %s', 'client-and-product-testimonials'), '<small>(' . __('check this field and save the testimonial to reveal additional fields', 'client-and-product-testimonials') . ')</small>'), 'id' => $prefix . 'video_testimonial_placeholder', 'type' => '', 'after' => '<p><a href="http://captpro.evan-herman.com/" class="button-primary button-hero" target="_blank">' . __('Upgrade Now to Enable Video Testimonials', 'client-and-product-testimonials') . '</a></p>')); /** * Initiate the 'About' metabox * @since 0.1 */ $about_metabox = new_cmb2_box(array('id' => 'about_the_author', 'title' => __('About', 'client-and-product-testimonials'), 'object_types' => array('testimonial'), 'context' => 'side', 'priority' => 'low', 'show_names' => true)); // Render About metabox // @since 0.1 $about_metabox->add_field(array('name' => '', 'desc' => '', 'id' => $prefix . 'about', 'type' => 'about_metabox')); /** * Upsell Details * @since 0.1 */ $upgrade_to_pro = new_cmb2_box(array('id' => $prefix . 'upgrade_to_pro', 'title' => ' ', 'object_types' => array('testimonial'), 'context' => 'side', 'priority' => 'low', 'show_names' => true)); /* * Video Testimonial Checkbox */ $upgrade_to_pro->add_field(array('name' => '', 'desc' => '', 'id' => $prefix . 'pro_upsell', 'type' => 'pro_upsell_metabox')); }
function course_mb($meta_boxes) { $prefix = ""; $webinar = new_cmb2_box(array('id' => 'course-data', 'title' => 'Course Details', 'object_types' => array('citrix_training'), 'show_on' => array(), 'context' => 'side', 'priority' => 'default', 'show_names' => true)); $webinar->add_field(array('name' => 'Training Key', 'id' => $prefix . 'training_key', 'type' => 'text', 'options' => array())); $webinar->add_field(array('name' => 'Course Price', 'id' => $prefix . 'course_price', 'type' => 'text', 'options' => array('before' => '$'))); $webinar->add_field(array('name' => 'Course Discount', 'id' => $prefix . 'course_discount', 'type' => 'text', 'options' => array('before' => '$'))); }
/** * Define the metabox and field configurations. */ function catalogues_metaboxes() { // Start with an underscore to hide fields from custom fields list $prefix = '_ad_catalogues_'; ///// PDF Download $cmb = new_cmb2_box(array('id' => 'catalogue_meta', 'title' => __('Catalogue Download', 'cmb2'), 'object_types' => array('catalogues'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true)); $cmb->add_field(array('name' => 'Download Link', 'desc' => '', 'id' => $prefix . 'download_link', 'type' => 'file')); }
function dg_download() { $prefix = '_dg_'; $cmb_group = new_cmb2_box(array('id' => $prefix . 'metabox2', 'title' => __('Upload Files', 'dcastalia'), 'object_types' => array('download'))); $group_field_id = $cmb_group->add_field(array('id' => $prefix . 'download', 'type' => 'group', 'description' => __('Upload downloadable files', 'dcastalia'), 'options' => array('group_title' => __('File {#}', 'dcastalia'), 'add_button' => __('Add Another File', 'dcastalia'), 'remove_button' => __('Remove File', 'dcastalia'), 'sortable' => true))); $cmb_group->add_group_field($group_field_id, array('name' => __('File Title', 'dcastalia'), 'id' => 'title', 'type' => 'text')); $cmb_group->add_group_field($group_field_id, array('name' => __('Select File', 'dcastalia'), 'id' => 'download', 'type' => 'file')); }
/** * Add the options metabox to the array of metaboxes * @since 0.1.0 */ function add_options_page_metabox() { $cmb = new_cmb2_box(array('id' => $this->metabox_id, 'hookup' => false, 'show_on' => array('key' => 'options-page', 'value' => array($this->key)))); // Set our CMB2 fields $cmb->add_field(array('name' => __('Ratings Granular Control', 'wds_ratings'), 'id' => 'filter_type', 'type' => 'radio', 'options' => array('exclusive' => __('Option to Hide', 'wds_ratings') . '<p class="cmb2-metabox-description">' . __('Defaults to the checkbox on the post/page edit screen causing the rating to be <strong>removed</strong> from that post (while others are on by default).', 'wds_ratings') . '</p>', 'inclusive' => __('Option to Show', 'wds_ratings') . '<p class="cmb2-metabox-description">' . __('Defaults to the checkbox on the post/page edit screen causing the rating to be <strong>added</strong> to that post (and others are off by default).', 'wds_ratings') . '</p>'), 'default' => 'exclusive')); $cmb->add_field(array('name' => __('Enable Content Filter', 'cmb2'), 'desc' => __('Automatically add ratings before post content', 'wds_ratings'), 'id' => 'enable_content_filter', 'type' => 'checkbox')); $cmb->add_field(array('name' => __('Enable Widget', 'cmb2'), 'id' => 'enable_widget', 'type' => 'checkbox')); }
/** * Build our meta boxes */ public function do_meta_boxes($meta_boxes) { $prefix = '_wds_builder_'; $object_types = wds_page_builder_get_option('post_types') ? wds_page_builder_get_option('post_types') : array('page'); $cmb = new_cmb2_box(array('id' => 'wds_simple_page_builder', 'title' => __('Page Builder', 'wds-simple-page-builder'), 'object_types' => $object_types, 'context' => 'normal', 'priority' => 'high', 'show_names' => true)); $group_field_id = $cmb->add_field(array('id' => $prefix . 'template', 'type' => 'group', 'options' => array('group_title' => __('Template Part {#}', 'wds-simple-page-builder'), 'add_button' => __('Add another template part', 'wds-simple-page-builder'), 'remove_button' => __('Remove template part', 'wds-simple-page-builder'), 'sortable' => true))); $cmb->add_group_field($group_field_id, array('name' => __('Template', 'wds-simple-page-builder'), 'id' => 'template_group', 'type' => 'select', 'options' => wds_page_builder_get_parts())); }