create post types wordpress oop code example
Example: wordpress create new post type
/*
- The function you want for creating a custom wordpress post type is
register_post_type()
- https://developer.wordpress.org/reference/functions/register_post_type/
- To add more meta boxes to the post type search for the support items in the
above link.
- Below is a basic implementation of the function to register video post type
*/
register_post_type( 'video',
array(
'labels' => array(
'name' => 'Videos',
'singular_name' => 'Video'
),
'public' => true,
'has_archive' => true,
'rewrite' => array(
'slug' => 'videos'
),
'exclude_from_search'=> true
,
'supports' => array(
'title','editor','thumbnail'
)
)
);