// This is how you add a CMB2 field per the CMB2 docs
$cmb->add_field( array(
'name' => 'Test File',
'desc' => 'Upload an image or enter an URL.',
'id' => 'my_custom_test_image',
'type' => 'file',
// Optionally hide the text input for the url:
'options' => array(
'url' => false,
),
) );
// We don't need $cmb->add_field() for shortcode builder. Use the inner array
array(
'name' => 'Test File',
'desc' => 'Upload an image or enter an URL.',
'id' => 'my_custom_test_image',
'type' => 'file',
// Optionally hide the text input for the url:
'options' => array(
'url' => false,
),
)