Register A Custom Post Type and Display it in WordPress

Use this code to register a custom post type, remember you need to write it in your functions.php file and wrap it with a function. Then call it by init action hook. Example –

function custom_post(){
$labels = array(
            'name'                  => ( 'post type plural name'),
            'singular_name'         => ( 'post type singular name' ),
        $args = array(
            'labels'             => $labels,
            'public'             => false,
            'show_ui'            => true,
            'show_in_menu'       => true,
            'supports'           => array( 'menu_order','page-attributes','title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments','custom-fields' ),
        register_post_type( 'post-type', $args );
add_action( 'init', 'custom_post' );

Then you need to display it to your template file, question how? We can display it with a query and piece of code.

global $post;
					'post_type'      => 'your-post-type',
					'post_status'    => 'post-status',
					'posts_per_page' => 3,
					'order' => 'DESC',
				$my_posts = get_posts( $args );
				foreach ( $my_posts as $post){
				the_content();// and more that you want to display