Skip to main content
Rollback to Revision 1
Link
fuxia
  • 107.1k
  • 38
  • 255
  • 459
add tag
Link
Travis Northcutt
  • 3.4k
  • 5
  • 43
  • 60
Source Link
lea
  • 23
  • 4

CMB2 installation - cannot get it to work

I have followed the documentation on this page: https://github.com/WebDevStudios/CMB2/wiki/Basic-Usage but cannot get it to work.

I have gone through other posts with the same issue and tried all of the suggestions and still nothing. This has left me confused onthe installation process.

Can someone confirm whether the following code is needed?

if ( file_exists( DIR . '/cmb2/init.php' ) ) { require_once DIR . '/cmb2/init.php'; } elseif ( file_exists( DIR . '/CMB2/init.php' ) ) { require_once DIR . '/CMB2/init.php'; }

and also whether the cmb2 folder should be installed in the theme folder or the plugin folder. Documentation says theme, installation page on wordpress says plugin.

Also where should the code from example_functions.php go? Should it be in the functions.php file in the theme folder?

I have installed the plugin via wordpress and therefore the folder is installed in the plugins folder. I have then copied and pasted all of the code from example_functions.php into my functions.php file within my theme folder. I have then added the below code to the page.php file in my theme folder.

$text = get_post_meta( get_the_ID(), '_cmb2_text', true ); echo $text;

Please help.