This snippet should only be attempted if you have a basic understanding of PHP and where to place the code.

WordPress allows us the ability to create Custom Post Types, These are useful for all kinds of things, For example if you ran a Car Dealership and wanted to post details about your cars for sale, Sure you could use an e-commerce platform, But what if you didn’t want them to be purchased online? Catalog mode would work but it’s still an awfully bloated plugin for this purpose. So lets dive in!

So firstly we’re going to need to create the actual post type. In this example lets use Cars.

function create_cars_cpt() {
    register_post_type( 'cars', //
            'labels' => array(
                'name' => __( 'Cars' ),
                'singular_name' => __( 'car' )
            'public' => true,
            'has_archive' => true,
            'rewrite' => array('slug' => 'cars'),
            'show_in_rest' => true,

add_action( 'init', 'create_cars_cpt' );

What this does is create the post type with the name “Cars”.

By default this will use the standard WordPress archive template. In my next snippet i’ll be showing you how create custom page templates for your new post type!

If you require any assistance with this snippet, Please contact me!

if you require any assitance with this snippet, feel free to Contact Me and i will be happy to assist you.