Site logo

Archived topic

Only shows posts related to a single category

11 replies · Started by Bhavleen on July 11, 2022

Viewing posts 1–12 of 12

Hey guys!

I have created this query loop for my category pages.

I need only to add posts that are related to a particular category on each page.

How can I do that with GP?

Also, don't know why but I have created a query loop with 6 posts, but there is a repetition of posts.

How can I resolve that as well?

Please help!

Hi Bhavleen,

A query loop block is NOT supposed to be added as ablock element - content template.

There should be only ONE post/post template inside the content template, please watch this video to understand how the content template works:https://docs.generatepress.com/article/block-element-content-template/

The query loop block is supposed to be added to a static page or to the archive as a hook.

Hi Ying,

So, I will have to change the block to hook?

In your case, you are using the default category archive page, it's not a static page, so do NOT use the query loop block in the element.

And keep the element as a content template.

Hi!

So I have changed the element type and chosen a default template.

I need to remove the space in between cards so that three posts are in the same row.

Can someone please help me with that?

Hi there,

in Customizer > Layout > Blog you can set the Columns to 3

Thanks David

Can you please look at the mobile version the cards are stretched to both ends of the page.

I tried to play with the width but I didn't find an option to do it while working.

Can you suggest something that would resolve this issue?

Thanks

In Customizer > Layout > Container - what Left and Right Padding values do you have ?

Ok, add this CSS to your site:

.generate-columns-activated .site-main {
    padding: 0 20px;
}

Thanks David.

This code resolved the issue.

Glad to hear that

This archived topic is closed to new replies.