Skip to content

Instantly share code, notes, and snippets.

@clifgriffin clifgriffin/cmb2-configuration.php Secret
Last active Aug 29, 2015

Embed
What would you like to do?
Gravity Forms Download Lead Capture: CMB2 Configuration
<?php // Don't include opening PHP tag
add_filter( 'cmb2_meta_boxes', 'cmb2_download_metabox' );
/**
* Define the metabox and field configurations.
*
* @param array $meta_boxes
* @return array
*/
function cmb2_download_metabox( array $meta_boxes ) {
// Start with an underscore to hide fields from custom fields list
$prefix = '_cgd_';
// Metabox for Download Custom Post Type
$meta_boxes['download_settings'] = array(
'id' => 'download_settings',
'title' => 'Download Settings',
'object_types' => array( 'download', ), // Only Show on Download CPT
'context' => 'normal',
'priority' => 'high',
'show_names' => true,
'fields' => array(
array(
'name' => 'Download File',
'desc' => 'Upload the file that you would like to offer as a download.',
'id' => 'download_file',
'type' => 'file',
),
),
);
return $meta_boxes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.