-
Notifications
You must be signed in to change notification settings - Fork 566
Installation
Justin Sternberg edited this page Apr 5, 2020
·
15 revisions
Table of Contents generated with DocToc
- If installing the plugin from wordpress.org:
- If including the library in your plugin or theme:
- If including the library via composer in PSR-4 format (Example Antonella Framework)
- If including the library via composer (not PSR-4 format)
- Upload the entire
/CMB2directory to the/wp-content/plugins/directory. - Activate CMB2 through the 'Plugins' menu in WordPress.
- Copy (and rename if desired)
example-functions.phpinto to your theme or plugin's directory andrequire_oncefrom your theme or plugin's main file. - Edit to only include the fields you need and rename the functions.
- Profit.
- Place the CMB2 directory inside of your theme or plugin.
- Copy (and rename if desired)
example-functions.phpinto a folder above the CMB2 directory OR copy the entirety of its contents to your theme'sfunctions.phpfile. - Edit to only include the fields you need and rename the functions (CMB2 directory should be left unedited in order to easily update the library).
- Profit.
Important Notes
- Please review the caveats for bundling and including CMB2 .
- when bundling CMB2 with your theme or plugin, you will want to use the release package. You can download the zip file from the WordPress plugin repo, or using the download link on Github. It is recommended that you not clone CMB2 into your project. This will ensure your bundled version does not contain the development-only files/folders.
in composer.json file:
"require": {
"cmb2/cmb2": "dev-master"
},
"autoload": {
"files": ["vendor/cmb2/cmb2/init.php"]
}in composer.json file:
{
"require": {
"php": ">=5.3.0",
"composer/installers": "v1.0.12",
"cmb2/cmb2": "dev-master"
},
"autoload": {
"files": ["vendor/cmb2/init.php"]
},
"extra": {
"installer-paths": {
"vendor/{$name}/": ["cmb2/cmb2"]
}
}
}Documentation:
-
Installation
Installation instructions for various environments -
Basic Usage
Get up and running -
Advanced Usage
Not for the faint of heart -
Field Types
Breakdown of field types -
Examples
Examples for registering fields -
Field Parameters
Breakdown of common field parameters -
Display Options
Limit display of boxes -
Box Properties
Breakdown of box properties -
Troubleshooting
Common issues & how to deal with them -
Notable Changes in CMB2 (from original CMB)
CMB2 — a complete re-write -
Tips & Tricks
10x your CMB2 skills -
REST API
CMB2 data through WordPress REST API -
Javascript API
Work with CMB2 JS events & hooks
Advanced tutorials:
- Adding your own field types
- Adding your own show_on filters
- Displaying boxes on the front-end
- Using CMB to create an Admin Theme Options Page
- Create New Posts (or Custom Post Type) Entries Using A Front End Form
- Disable CMB2 Styles on Front End Forms
External Resources: