• How to create your own post type template correctly?

    1. single.php

    get_header();
    if (
    	! function_exists('elementor_theme_do_location')
    	||
    	! elementor_theme_do_location('single')
    ) {
    	get_template_part('template-parts/single');
    }
    //+ MY CTP PAGE
    if (
    	! function_exists('elementor_theme_do_location')
    	||
    	! elementor_theme_do_location('single')
    ) {
    	get_template_part('template-parts/single-mycpt');
    }
    //- MY CTP PAGE
    get_footer();
Viewing 1 replies (of 1 total)
  • Theme Author creativethemeshq

    (@creativethemeshq)

    @xpood Hi, thanks for reaching out!

    The best way to achieve this will be to create a “single-mycpt.php” file inside your child theme. And there you will need to call your template part, like this: “get_template_part(‘template-parts/single-mycpt’)”. And inside “template-parts/single-mycpt” you can put all your logic for the single page of the custom post type.

    Hope this helps.

    Best,
    Andrei.

Viewing 1 replies (of 1 total)
  • The topic ‘How to create your own post type template correctly?’ is closed to new replies.