Skip to content

Instantly share code, notes, and snippets.

@gbissland
Created February 8, 2018 01:33
Show Gist options
  • Save gbissland/f71d067c598e6f10d443c0b9d5009c34 to your computer and use it in GitHub Desktop.
Save gbissland/f71d067c598e6f10d443c0b9d5009c34 to your computer and use it in GitHub Desktop.
cpt_projects for Camel
if ( ! function_exists('cpt_projects') ) {
// Register Custom Post Type
function cpt_projects() {
$labels = array(
'name' => 'project',
'singular_name' => 'Project',
'menu_name' => 'Camel Projects',
'name_admin_bar' => 'Post Type',
'archives' => 'Project Archives',
'attributes' => 'Item Attributes',
'parent_item_colon' => 'Parent Item:',
'all_items' => 'All Projects',
'add_new_item' => 'Add New Project',
'add_new' => 'Add New Project',
'new_item' => 'New Project',
'edit_item' => 'Edit Project',
'update_item' => 'Update Item',
'view_item' => 'View Project',
'view_items' => 'View Projects',
'search_items' => 'Search Item',
'not_found' => 'Not found',
'not_found_in_trash' => 'Not found in Trash',
'featured_image' => 'Featured Image',
'set_featured_image' => 'Set featured image',
'remove_featured_image' => 'Remove featured image',
'use_featured_image' => 'Use as featured image',
'insert_into_item' => 'Insert into item',
'uploaded_to_this_item' => 'Uploaded to this item',
'items_list' => 'Items list',
'items_list_navigation' => 'Items list navigation',
'filter_items_list' => 'Filter items list',
);
$rewrite = array(
'slug' => 'project',
'with_front' => true,
'pages' => true,
'feeds' => true,
);
$args = array(
'label' => 'Project',
'description' => 'Camel builds & projects',
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail', 'revisions' ),
'taxonomies' => array( 'category' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-admin-home',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => 'projects',
'exclude_from_search' => false,
'publicly_queryable' => true,
'rewrite' => $rewrite,
'capability_type' => 'post',
);
register_post_type( 'project', $args );
}
add_action( 'init', 'cpt_projects', 0 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment