Insert posts from a category with Query Loop

Hi there!,

I’ve created a content template for showing post categories and I’m trying to show posts from that category on the page but it is showing posts from other categories. Am I missing the obvious!!?


Hi @DigitalTom,

May we know what specifically you are trying to do?

For reference, here’s an article with regards to Content Templates: Block Element - Content Template - Documentation

You shouldn’t put Query Loop Blocks inside your Content Template.

Thanks for replying @fernandoazarcon2

I’m trying to build a post category archive page, I’ve created it Elements > Content Template. I used query loop in the content template to try and pull in the posts from one category.

I was thinking that I could build one content template for all post categories and when the categoey archive is viewed, it would display the posts from that one category. I hope all that makes sense!

Can I ask please, why can’t you use query loop in a content template?

Is it possible to achieve one template for all categories another way?

Huge thanks!

the look of how posts appear in an Archive/Blog page. If you add a Query Loop Block inside your Content Template, it would produce loop of posts within a loop of posts.

You could try it out and go to your archive page to see what I mean.

If you’re trying to customize the look of how posts appear or in other words, the template in you automatically generated archive/blog pages, then using a Content Template without a Query Loop Block would do.

If you’re trying to add a query of posts in a static page, the that’s when you’ll need a Query Loop Block.

Hope this clarifies!

Thank you @fernandoazarcon2 that explains eveything!

Much appreciated!

You’re welcome @DigitalTom!