Archived topic
How hook block template to existing page
3 replies · Started by Radek on October 6, 2021
Hi, is there some way to hook Block template made for CPT archive/loop to existing page after its content ? Or maybe is better hook some statis content (made witch blocks) to Archive page of my CPT ? Thanx.
Hi there,
1. if you're trying to display a list of your CPTs on a static page then NO you cannot use a Content Template for that as there is no Loop being generated for it.
2. if your CPTs are built using GP Templates then it will include all the hooks present on that template. See here for examples:
https://docs.generatepress.com/article/hooks-visual-guide/
Then you can hook a block element into them.
ad #2: do You mean Single CPT layout ? No, I create only template for archive/loop and I need display it with some other content. Is it possible without coding ? I used WP Show Post for it for now, but there is poor design :)
My CPT is made with PODS and it only use Title + Featured Image.
If its an archive page then you can use the Block Element Content Template on them:
https://docs.generatepress.com/article/block-element-content-template/
Under the display rules you should see your Post Type archive as an option.