Archived topic
filter Category for query loop
52 replies · Started by Jusung on February 1, 2023
Hello!
When you see this page on the link,
you can see 5 buttons, which are All, SEO, Anaysis, Ads, Globalization.
It indicates category.
So, when the button is clicked, I only wanna show the posts that in the category that is clicked.
I can think that I make 5 same pages, but shows posts in different categories.
Is this only way to make this or is there a way to make this in one page?
Thank you always!
Hi there,
i would have each of those buttons link to your post category archive.
And then use a Block Element - Loop Template for your Query Loop block:
https://docs.generatepress.com/article/block-element-loop-template/
It is complicated.
When I make Loop Template, I can't set hook-after header, which means the merged header is gone..
Also, since the button is 5, am I supposed to make 5 block elements?
Hi Jusung,
What David suggests is to display the Block Element you have for the Buttons on archive pages, and link each button to the default created archive pages.
Then, for the archive pages, use a Block Element - Loop Template to style the posts.
Make sure to enable "Inherit Query from Template" option in the Loop Template.
Sorry. I don't understand...
I have made a page(portfoilo). You are saying I have to make (location: All archives) not page:portfolio?
and links all the bettons to the the page(location: All archives)?
and I have to make a block (loop template)
I really don't understand how this works..
It's actually just a suggestion. What you had in mind is alright as well.
What we were referring to is using the default archive pages instead of creating new pages.
Can you provide admin login credentials so we can take a closer look at your setup?
Please use the Private Information field for this: https://docs.generatepress.com/article/using-the-premium-support-forum/#private-information
I just created a new user to edit.
I want to follow your suggestion since my way doesn't look good.
Can you change the user to an admin?
Just changed it to admin.
1. Create a new Block Element - Hook but only keep this Container and its content: https://share.getcloudapp.com/eDunDKAl
2. Set the Block Element "Portfolio Page" to only appear on the Portfolio page.
3. Create a Block Element - Loop template. Assign it to display on the 5 category archive pages. Add a Query Loop. Make sure to enable “Inherit Query from Template” option in the Loop Template settings.
This should fix your structure.
I have done what you said, but it doesn't work.
I don't understand how the archive can be shown up on the portfolio page..
I also added the link on the button, but when I click it, it directs me to blog..
Each link has to point to the relevant archive page
eg.
https://your_domainname/category/all/po-analysis/
Yes. I have given the right link to each button.
but when I click it, it directs me to the blog page, not portfolio..
I think I need to change the location setting on blog and portfolio content.
Yes, that's the correct setup.
You just need to replace the display rule location of the Portfolio Head Element as such: https://share.getcloudapp.com/Z4um8LWp
Add the other category archive pages as well to the display rule location.
I changed it as you said.
However, I can see the right sidebar that I want to remove.
Also, I can't see the merged head...
On my blog,
Blog
Search Results
Post Category: Content Marketing [SEO]
Post Category: Performance Marketing
Post Category: Advertising Strategy
Post Category: International Marketing
On the portfolio head
Post Category: All
Post Category: po-SEO
Post Category: po-Analysis
Post Category: po-Ads
Post Category: po-Globalization
On the portfolio content
All Archives
These are what is set..
I think this is really complicated to me cuz there is no sidebar on portfolio and there is a sidebar on blog..