Site logo

Archived topic

Custom Post Type single template

1 reply · Started by James on March 19, 2021

Viewing posts 1–2 of 2

Hi there,

I've created a Custom Post Type and followed these instructions for setting up the template:

https://docs.generatepress.com/article/setting-up-a-simple-custom-post-type/

When I view a single CPT post the changes in the content template aren't used. In my old theme I named the file single-reviews.php rather than reviews.php as suggested above.

After doing that the content area of the post isn't shown, but if I replace the suggested change in step 3:

generate_do_template_part( 'reviews' );

with

get_template_part( 'content', 'reviews' );

the template is used correctly.

Is this approach correct? Although it works I wondered if I might be missing anything by not using generate_do_template_part()?

Many thanks.

Hi there,

apologies - your topic slipped through our system. Do you still need assistance with this?

This archived topic is closed to new replies.