Archived topic
Replace blog page and archives with Queryloops?
10 replies · Started by Jonas on July 13, 2022
Hi! I´m am trying to learn Wordpress, Generatepress and Generateblocks and understand how to use it all together. Are the most people replacing Wordpress blogpage and category-archives with the new query loops? Or is it more ment to be used as for example to show the last 4 blogposts on the Homepage? Is there any right or wrong in that? Because I can see the point of being able to customize the blogpage more. But for example, the category query loop term links to the Wordpress category archive page of that category with made me confused. Or is there a way to link that to a static category page built with Query loops?
Kind regards/Jonas
Hi there,
in an upcoming update to GP Premium we will be adding a feature to the Block Elements module that will allow you to remove the Themes Loop from any template. And in its place you can build out the block element using the Query Loop Block ( or any other blocks ). In the instances where the query is defined by the template eg. a Category Archive, you can use Inherit query from template toggle in the GB Query Loop block. And GP and GB will do the rest. So you could build one element that displays a custom query loop on all category archives for example.
It is possible to do this today, but requires some custom development.
There are also some other alternative methods that hijack the template hierarchy to show a static page in place of the category template. Theres a doc on that here
Personally if you feel the need to rebuild the entire loop then wait for the next GP Premium update.
Or if you just want design your post content templates for your archives then use a Block Element - Content Template:
https://docs.generatepress.com/article/block-element-content-template/
Thank you for the answer David!
/Jonas
You're welcome
Dear David,
Do you have any news on this feature to the Block Elements module that will allow to remove the Themes Loop from any template.
I'd also like to replace blog page and archives with Queryloops.
Thanks
Hi there,
its currently planned for GP 3.1.4 and GPP 2.2 - which are the next updates for the theme and premium.
We haven't set a date for the release yet, but i would expect we will begin alpha testing in the next 30 days.
Thank you David and all the team. I saw Alpha announcement on the FB group ;-)
Hi team
I used you snippet PHP code to replace the category archive by a single page : https://staging-darwinnutritionfr-dev.kinsta.cloud/super-aliments.
It works, but now the problem is that all posts in this category (super-aliments), such as https://staging-darwinnutritionfr-dev.kinsta.cloud/super-aliments/acai/ are driving to the category page.
Would you know why ?
When I deactivate the snippet, the URL for the posts are working and driving to the posts.
Thank you for you help
Quentin
Hi there,
if you're using Query Loops then don't use the Static Page method.
Instead create a Block Element - Loop Template:
https://docs.generatepress.com/article/block-element-loop-template/
Add you GB Query Loop block, and in it Settings enabled: Inherit Query from Template
Set the Display Rules to: All Archives and the Blog if you want it every where. Or just the specific Post Category Archives you need it for
Thank you David!
You're welcome