Archived topic
Best Approach for Custom Post Types to display on Pages
5 replies · Started by Ema on November 30, 2021
Hello, I am wondering what the best approach is for creating custom posts and displaying them on the front end.
I have created a few CPTs such as; Publications, Reports, Events, by registering them by via functions.php and following David's instructions
I copied the content.php and single.php templates from GP -
Which works brilliantly.
However, this shows the posts as an archive page, which I'm not able to style, add extra sections to? (see Screengrab link below)
The plan is to :
have a CPT for 'Events' (should I name this 'events-archive'?)
Then, a Page for 'Events' which I can feed the 'Events' posts into. (I usually thread the posts via WP Show posts, but would like to bring these in as a posts loop this time)
I hope I am making sense. Your guidance would be most appreciated.
Ema
Hi there,
at this current time, the WPSP plugin is still the simplest way to go.
We're working on a Query Loop Block for GenerateBlocks which will do this - but that won't be around until the start of 2022.
I see. Thanks David. Oh, good news on the query loop for blocks
I'm wondering how to create a custom post type 'Projects' (by adding CPT the to function.php) without the page I've created for 'Projects' changing into a post type/archive. Should I turn 'archive to => false?
or perhaps call the project cpt something different like 'my-projects'?
Would ideally want projects as a page - then thread in the 'project' posts via WPSP.
I don't know why this confusing me so much :-)
Ema
If you don't require the Archive then:
Should I turn ‘archive to => false? -- Yes :)
Or change the CPT slug :)
Ha! Was getting myself in a pickle there.
Thank you so much for your time and help David
Very best
You're welcome :)