Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Conectad Training

// Register Custom Post Type
function bp_pt_custom_post_types() {

	$labels = array(
		'name'                => _x( 'Trainings', 'Post Type General Name', 'bp-profile-training' ),
		'singular_name'       => _x( 'Training', 'Post Type Singular Name', 'bp-profile-training' ),
		'menu_name'           => __( 'Training', 'bp-profile-training' ),
		'parent_item_colon'   => __( 'Parent Training:', 'bp-profile-training' ),
		'all_items'           => __( 'All Trainings', 'bp-profile-training' ),
		'view_item'           => __( 'View Training', 'bp-profile-training' ),
		'add_new_item'        => __( 'Add New Training', 'bp-profile-training' ),
		'add_new'             => __( 'Add New', 'bp-profile-training' ),
		'edit_item'           => __( 'Edit Training', 'bp-profile-training' ),
		'update_item'         => __( 'Update Training', 'bp-profile-training' ),
		'search_items'        => __( 'Search Training', 'bp-profile-training' ),
		'not_found'           => __( 'Training not found', 'bp-profile-training' ),
		'not_found_in_trash'  => __( 'Training not found in Trash', 'bp-profile-training' ),
	);
	$rewrite = array(
		'slug'                => 'training',
		'with_front'          => true,
		'pages'               => true,
		'feeds'               => true,
	);
	$args = array(
		'label'               => __( 'training', 'bp-profile-training' ),
		'description'         => __( 'Buddypress Profile Training Custom Post Type', 'bp-profile-training' ),
		'labels'              => $labels,
		'supports'            => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields', 'post-formats', ),
		'taxonomies'          => array( 'training_cat', 'training_tag' ),
		'hierarchical'        => false,
		'public'              => true,
		'show_ui'             => true,
		'show_in_menu'        => true,
		'show_in_nav_menus'   => true,
		'show_in_admin_bar'   => true,
		'menu_position'       => 5,
		'can_export'          => true,
		'has_archive'         => true,
		'exclude_from_search' => false,
		'publicly_queryable'  => true,
		'rewrite'             => $rewrite,
		'capability_type'     => 'post',
	);
	register_post_type( 'training', $args );

}

// Hook into the 'init' action
add_action( 'init', 'bp_pt_custom_post_types', 0 );