Installation - krunchness/CMB2 GitHub Wiki
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)
If installing the plugin from wordpress.org:
- 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 andrequire_once
from your theme or plugin's main file. - Edit to only include the fields you need and rename the functions.
- Profit.
If including the library in your plugin or theme:
- Place the CMB2 directory inside of your theme or plugin.
- Copy (and rename if desired)
example-functions.php
into a folder above the CMB2 directory OR copy the entirety of its contents to your theme'sfunctions.php
file. - 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.
If including the library via composer in PSR-4 format (Example Antonella Framework)
in composer.json file:
"require": {
"cmb2/cmb2": "dev-master"
},
"autoload": {
"files": ["vendor/cmb2/cmb2/init.php"]
}
If including the library via composer (not PSR-4 format)
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"]
}
}
}