How to use CMB2 as a Metabox in WordPress?

How to use CMB2 as a Metabox in WordPress?

CMB2 is a complete rewrite of Custom Metaboxes and Fields for WordPress. To get started, please follow the examples in the included example-functions.php file and have a look at the basic usage instructions. You can see a list of available field types here.

What are the custom field types in CMB2?

CMB2 Field Type: Select2 from mustardBees: Custom field types which use the Select2 script: The pw_select field acts much like the default select field. However, it adds typeahead-style search allowing you to quickly make a selection from a large list The pw_multiselect field allows you to select multiple values with typeahead-style search.

What is the PW multiselect field in CMB2?

The pw_multiselect field allows you to select multiple values with typeahead-style search. The values can be dragged and dropped to reorder CMB Field Type: Slider from mattkrupnik: Adds a jQuery UI Slider field. WDS CMB2 Date Range Field from dustyf of WebDevStudios: Adds a date range field.

Do you get admin page with CMB2?

CMB2 is actually a framework. As Sternberg once explained, “It’s a developer’s framework for easily building in forms and fields to your themes and plugins.” In fact, when you install CMB2, nothing will happen. You won’t get an admin page and there isn’t an admin user interface.

Do you have to write code to use CMB2?

To use CMB2 you have to be able to write code and add to your functions.php file. For that reason, I call it a ‘non-plugin’ plugin. The good news is that the plugin approval team has agreed to leave it in the repository, so you can continue to download and update it from there.

How to activate the CMB2 plugin in WordPress?

Upload the entire /CMB2 directory to the /wp-content/plugins/ directory. Activate CMB2 through the ‘Plugins’ menu in WordPress. Copy (and rename if desired) example-functions.php into to your theme or plugin’s directory. Edit to only include the fields you need and rename the functions.

How are field inputs powered by the CMB2 field type?

Field inputs are powered by the CMB2 Field Type: CMB2 Post Search field documented above, and so each link can be populated with existing WordPress content by clicking on the search button. Note: this is not a standard field type, but instead a function you use in combination with CMB2::add_field ().

What are the CMB2 field types for jQuery?

CMB Field Type: MultidatesPicker: Creates a CMB2 field type that enables a multiple date calendar. It uses a plugin called MultiDatesPicker v1.6.3 for jQuery UI. CMB Field Type: CMB2-radio-image: Image as radio buttons. CMB2 Term Select: Special CMB2 Field that allows users to define an autocomplete text field for terms.