Skip to content

Instantly share code, notes, and snippets.

@debabratakarfa
Last active July 4, 2017 19:29
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 debabratakarfa/8e26c6467776f3055b00fef94ddf5d92 to your computer and use it in GitHub Desktop.
Save debabratakarfa/8e26c6467776f3055b00fef94ddf5d92 to your computer and use it in GitHub Desktop.
// Register Custom Post Type
function videos_cpt() {
$labels = array(
'name' => _x( 'Videos', 'Post Type General Name', 'videos_post_type' ),
'singular_name' => _x( 'Video', 'Post Type Singular Name', 'videos_post_type' ),
'menu_name' => __( 'Videos', 'videos_post_type' ),
'name_admin_bar' => __( 'Video', 'videos_post_type' ),
'archives' => __( 'Video Archives', 'videos_post_type' ),
'attributes' => __( 'Video Attributes', 'videos_post_type' ),
'parent_item_colon' => __( 'Video Parent Video:', 'videos_post_type' ),
'all_items' => __( 'All Videos', 'videos_post_type' ),
'add_new_item' => __( 'Add New Video', 'videos_post_type' ),
'add_new' => __( 'Add New', 'videos_post_type' ),
'new_item' => __( 'New Video', 'videos_post_type' ),
'edit_item' => __( 'Edit Video', 'videos_post_type' ),
'update_item' => __( 'Update Video', 'videos_post_type' ),
'view_item' => __( 'View Video', 'videos_post_type' ),
'view_items' => __( 'View Items', 'videos_post_type' ),
'search_items' => __( 'Search Video', 'videos_post_type' ),
'not_found' => __( 'Not found', 'videos_post_type' ),
'not_found_in_trash' => __( 'Not found in Trash', 'videos_post_type' ),
'featured_image' => __( 'Featured Image', 'videos_post_type' ),
'set_featured_image' => __( 'Set featured image', 'videos_post_type' ),
'remove_featured_image' => __( 'Remove featured image', 'videos_post_type' ),
'use_featured_image' => __( 'Use as featured image', 'videos_post_type' ),
'insert_into_item' => __( 'Insert into item', 'videos_post_type' ),
'uploaded_to_this_item' => __( 'Uploaded to this item', 'videos_post_type' ),
'items_list' => __( 'Items list', 'videos_post_type' ),
'items_list_navigation' => __( 'Items list navigation', 'videos_post_type' ),
'filter_items_list' => __( 'Filter items list', 'videos_post_type' ),
);
$args = array(
'label' => __( 'Video', 'videos_post_type' ),
'description' => __( 'Videos Post Description', 'videos_post_type' ),
'labels' => $labels,
'supports' => array( 'title', 'author', 'editor', 'custom-fields', ),
'taxonomies' => array( 'category', 'post_tag' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-format-video',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
);
register_post_type( 'videos', $args );
}
add_action( 'init', 'videos_cpt', 0 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment