How to create custom post type in WordPress
After installing a fresh WordPress environment a user normally get posts, pages, and media built in content types. expect these if a user want to use any other content types then have to create custom post types for that.
in WordPress codex.org custom post types known as custom content types
different types of post can be added by using a simple WordPress function called register_post_type().
This function allows to add new custom post type into theme.
WordPress supports unlimited number of custom post types when needed. For example if anyone run a service related website and want to add a custom post type titled ‘Services’ then follow like below
Create a custom post type titled ‘Services’
For creating a custom post type in any WordPress theme add following code into functions.php file
/* Custom Post Type*/ function custom_post_type() { register_post_type( 'services', array( 'labels' => array( 'name' => __( 'services' ), 'singular_name' => __( 'Servicese' ) ), 'public' => true, 'has_archive' => false, 'rewrite' => array('slug' => 'services'), ) ); } add_action( 'init', 'custom_post_type' );