Query string for archive layout

Hi!

I’m trying to create a layout for the archive pages of a custom post type.

My post type name: rabatter (means discounts)
My taxonomy name: rabat_type (means discount type)
The specific category slug: stor-rabat (means big discount)

I have categories such as clothes, food, culture, etc. (these are where the layout is intended to be used)
I also have categories named: Big discount, medium discount and national discount. (used to detirmin how the discount should be displayed.

On each of the pages, i want the big discounts shown first with one layout, the medium to come second with another layout and lastly the national ones with a third layout.

I’m trying to create a string that will call the big discounts of the current category that the looper provider will fetch. Then of course each row would have the elements from the post.

I’ve used query builders before, but not the strings, that’s why i need a bit of help.

I tried this string:

category_name={{dc:term:slug}}&post_type=rabatter&tax_query%5B0%5D%5Btaxonomy%5D=rabat_type&tax_query%5B0%5D%5Bfield%5D=name&tax_query%5B0%5D%5Bterms%5D=stor-rabat&tax_query%5B0%5D%5Boperator%5D=IN

and this:
category_name={{dc:term:slug}}&post_type=rabatter&tax_query[0][taxonomy]=rabat_type&tax_query[0][field]=name&tax_query[0][terms]=stor-rabat&tax_query[0][operator]=IN

But both without success.

I’m assuming it’s the string that’s written incorrectly, right?

Could you please explain how it’s wrong?

Kindest regards,
Johan

Hi Johan,

Thanks for reaching out.
It seems that you are trying to get the specific category posts from a custom post type, if that is the case you just need to specify the taxonomy name in place of category_name. Your query should look like the following one.

rabat_type=stor-rabat&post_type=rabatter

I went ahead and added the above query into the Query String and it worked, please find the test page URL in the secure note.

Hope it helps.
Thanks

It’s also supposed to filter on the current category.

Check the layout on the link attached in note.

Hello @Johanschack,

Actually, when you are using the Archive layout, you do not need a Looper Provider. You can simply disable the Looper provider and use only the Looper Consumer. You will have to let WordPress do its thing and generate the posts according to the queried object. Kindly check out the example page in the secure note.

Thanks.

But then you haven’t understood my original request. I want the first section to show posts of the current category AND with “stor-rabat” category attached.

Currently it’s providing ALL of current category.

I have made a quick sketch of how the page structure should look like when correct:

Hey @Johanschack,

Regretfully, it’s not possible out of the box to combine the current category and a specific category. You will need to create your own Custom Looper. If you’re a PHP developer, you can learn how to create a Custom Looper here https://theme.co/docs/loopers#custom

Note that since it involves custom coding, creating a Custom Looper is beyond the scope of our theme support. But, we have a service plan if you wish to receive further guidance. The plan is called One (https://theme.co/one).

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.