Skip to content

Instantly share code, notes, and snippets.

@clifgriffin
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clifgriffin/73879e3d0e15dbd23933 to your computer and use it in GitHub Desktop.
Save clifgriffin/73879e3d0e15dbd23933 to your computer and use it in GitHub Desktop.
Gravity Forms Download Lead Capture: Custom Post Type for Downloads
<?php // Don't include opening PHP tag
add_action( 'init', 'register_cpt_download' );
function register_cpt_download() {
$labels = array(
'name' => _x( 'Downloads', 'download' ),
'singular_name' => _x( 'Download', 'download' ),
'add_new' => _x( 'Add New', 'download' ),
'add_new_item' => _x( 'Add New Download', 'download' ),
'edit_item' => _x( 'Edit Download', 'download' ),
'new_item' => _x( 'New Download', 'download' ),
'view_item' => _x( 'View Download', 'download' ),
'search_items' => _x( 'Search Downloads', 'download' ),
'not_found' => _x( 'No downloads found', 'download' ),
'not_found_in_trash' => _x( 'No downloads found in Trash', 'download' ),
'parent_item_colon' => _x( 'Parent Download:', 'download' ),
'menu_name' => _x( 'Downloads', 'download' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => false,
'description' => 'Private downloads.',
'supports' => array( 'title', 'editor', 'thumbnail' ),
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-download',
'show_in_nav_menus' => false,
'publicly_queryable' => true,
'exclude_from_search' => true,
'has_archive' => false,
'query_var' => true,
'can_export' => true,
'rewrite' => array('slug' => 'download', 'with_front' => false, 'feed' => false, 'pages' => false),
'capability_type' => 'post'
);
register_post_type( 'download', $args );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment