Site logo

[Support request] I’m Confused About How To Create Content Templates for Custom Post Types

Home Forums Support [Support request] I’m Confused About How To Create Content Templates for Custom Post Types

Home Forums Support I’m Confused About How To Create Content Templates for Custom Post Types

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2458256
    Josh

    Hi there,

    I’ve been reading through some support posts and they advise us to create single-custom-post-type.php and content-custom-post-type.php files to support our custom post types.

    But when I did that and tried to replace them with Content Templates in Elements, the Content Templates didn’t work until I deleted those PHP files.

    So, I’m a little confused. If we can just make Content Templates, what is the point of creating the physical PHP files? Do they work with other types of elements?

    Thank you for your time,

    Josh

    #2458370
    Fernando
    Customer Support

    Hi Josh,

    Content Templates should work with that setup. Perhaps you altered something in the code? It also works without those custom templates.

    If you’re planning to alter the structure of your CPT single posts and archive pages code-wise, it’s good to create and use custom template files.

    Otherwise, CPT end links will just use the default archive and single page/post template which is fine. Other Elements should still work.

    It’s more or less preferential.

    #2459224
    Josh

    Sorry, Fernando, but I’m still confused.

    The GeneratePress “way” is to use Elements to create a Content Template for the archive and single post for a custom post type.

    Is this correct?

    When I did this the Content Template Elements worked only AFTER I deleted the PHP files associated with the custom post type.

    Is that normal behavior?

    Thank you again,

    Josh

    #2459724
    Fernando
    Customer Support

    There’s no definite way to create Archive and Post templates. It all depends on your structure. But, we do recommend using a Block Element – Content Template or Loop Template if you want to extensively modify the Blog and Archive Pages. As for single Pages/Posts, it’s not conventional to use Content Templates here. We usually recommend using other types of Block Elements to build up single Posts/Pages.

    As for your second inquiry, no, this isn’t normal behavior. If you directly copy and paste the templates single.php, content-single.php and if you prefer, archive.php, Elements should still work. With this said, did you make any edits to your CPT template files?

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.