Archived topic
How to use the content template for a query loop
5 replies · Started by Jack on April 6, 2023
I watched the videos on how to create a content template and it seemed to be so easy, except here. ;)
I wanted to add a GP Query loop on a homepage, showing the latest 6 posts. Two categories so I wanted to create two content templates for them, but I have difficulty finding the right settings to get these content templates to apply on that query loop. Whatever I do, it just won't show on the homepage.
Hi there,
Any chance you can link us to the page in question?
You can use the private information field:
https://docs.generatepress.com/article/using-the-premium-support-forum/#private-information
Let me know :)
Hi Leo,
The website I'm working on is an new website in progress. See login info in the private field.
The homepage shows the query loop, and the Element Content template Nieuws should apply to that loop.
Layout needs work, but also need to know I can get this Element to work :)
Hi there,
GP Element Content Templates are built to hook into the themes templates, not a GB Query Loop. Although it is something we are looking at. So you need to copy your pattern from the Content Template and paste that or recreate it in your Query Loop.
If you want to keep the designs linked then a simple solution is:
1. edit your Content Template, select the Top level container block, and from its 3 dot menu make it into a Reusable Block.
2. in your Query Loop, start with an empty template, and add your Reusable block inside it.
Now whichever one you edit will update both places.
Thanks David. So I guess, until GP adds this to the GB Query Loop I will have to change colors (per category) using css.
Ah, ok so you need multiple content templates.
Yeah for now you will need CSS. Let us know if you need any assistance with that.