Copy and paste the code snippet below into your functions.php file, and edit the Events related text to match your new custom post type. Enjoy!
function add_custom_post_type() {
$labels = array(
'name' => _x( 'Events', 'Singular name' ),
'singular_name' => _x( 'Event', 'Plural name' ),
'add_new' => _x( 'Add New', 'event' ),
'add_new_item' => __( 'Add New Event' ),
'edit_item' => __( 'Edit Event' ),
'new_item' => __( 'New Event' ),
'all_items' => __( 'All Events' ),
'view_item' => __( 'View Event' ),
'search_items' => __( 'Search Events' ),
'not_found' => __( 'No events found' ),
'not_found_in_trash' => __( 'No events found in the Trash' ),
'parent_item_colon' => ’,
'menu_name' => 'Events'
);
$args = array(
'labels' => $labels,
'description' => 'The post type for our company events',
'public' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-calendar-alt',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),
'has_archive' => true,
'rewrite' => array('slug' => 'events'),
'hierarchical' => true,
'capability_type' => 'post',
);
register_post_type( 'event', $args );
}
add_action( 'init', 'add_custom_post_type' );
You can find information about the custom post type options via the register_post_type codex.