Skip to content

Instantly share code, notes, and snippets.

@clifgriffin
Last active August 29, 2015 14:13
Show Gist options
  • Save clifgriffin/44ac30efbe3c01b450aa to your computer and use it in GitHub Desktop.
Save clifgriffin/44ac30efbe3c01b450aa to your computer and use it in GitHub Desktop.
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