- This topic has 5 replies, 2 voices, and was last updated 3 years, 3 months ago by
Leo.
-
AuthorPosts
-
December 26, 2022 at 7:16 am #2473671
Stefanie
Hi there,
I’m confused about the two Element types “Content Template” and “Loop Template” and I don’t know when to use which type.
I’ve read the documentations, but am still confused about it.
https://docs.generatepress.com/article/block-element-content-template/
https://docs.generatepress.com/article/block-element-loop-template/In all these videos here: https://docs.generatepress.com/article/block-element-content-template/,
the type “Content Template” is used to display post-loops. But to display post-loops, shouldn’t you use the block type “Loop-Template” for that?If I want to design a post-archive, I would intuitively use the “Loop-Template” type for that. But in your videos only the type “Content-Template” is used.
Are there other use cases for the “Content-Template” type? And what exactly is the difference between these two types, or when do you use which type?
Thanks for clarification
StefanieDecember 26, 2022 at 12:11 pm #2474053Leo
StaffCustomer SupportHi Stefanie,
Excellent question 🙂
Content template: This option allows you to change the appearance of each of the blog post block on the posts page. It does not replace the default blog page structure or the loop structure.
You would not use a query loop block within a Content Template.
Loop template: This option basically gives you a clean slate of the posts page and allows you to edit it like a normal static page.
For example, you can add 5 query loop blocks to display 5 categories on the posts page and that would replace the default blog page structure or the loop structure.Let me know if this makes sense 🙂
December 27, 2022 at 6:07 am #2474640Stefanie
Hi Leo
thank you for your answer.
Yes, now it is starting to make sense to me 😉I’ll try to reproduce what I understood:
1. Content template: if I want to create a post-archive, then the content template is “only” used to influence the design for the single tile (card).
2. Loop-template: if I want to create a post-archive, then I can’t use the Loop-template to influence the design of the tile (card), but “only” to influence the structure of the whole page. E.g. I can put an explanatory text above the loop. Is that it?
3. And what do you mean by “you can add 5 query loop blocks to display 5 categories…” Would be a use case for this maybe this?: A page “Recipes” and on this page the 3 most recent posts from the categories “vegetables”, “fish” and “meat” are displayed (each with a link “Show everything from this category”).
That would actually be awesome!
Are there any other use cases for the Loop template? Or can I find a video somewhere?December 27, 2022 at 1:20 pm #2475067Leo
StaffCustomer Support1. Yes
2. Yes
3. By default, WordPress displays the most recent posts on the blog page and a content template allows you to change the appearance of those recent posts.
However, if you would like to change the default structure and display the most recent posts from 5 categories separately, then a Loop template and query loop blocks can be combined to achieve this.
Unfortunately there is no video currently – you have a decent understanding to go ahead and try it though. It’s the best way to learn!
December 28, 2022 at 10:54 am #2475997Stefanie
Hi Leo
I have now experimented a lot with the loop template and am making good progress. The difference has now become really very clear, thanks for your support!
I have found two good videos on the subject here:
https://www.youtube.com/watch?v=KnIOfBYAZ8Q https://www.youtube.com/watch?v=nBus9Z4UmI0Thanks again!
December 28, 2022 at 6:47 pm #2476336Leo
StaffCustomer SupportNo problem 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.