Crocoblock, add seperate listings in a taxonomy template

Short Answer
Are you creating an archive template for your taxonomies and have the same taxonomies in several CPTs? Want to have your archive template with seperate sections for each CPT? listing grid, select listing, No archive, post query=tax query, choose your taxonomy, operator=IN, field=term ID, terms=%queried_term%

As so often, Crocoblock shows huge potential but sometimes it just drives us crazy with their “hidden” queries and macros. :)

I was trying to achieve a “simple” tast .. create an archive template for my taxonomies.

I have done this several times without any problem, just add the listing widget, call your listing and activate “use as template” and voila. Very straight forward and simple.

But today I tried to do the same, but with one small difference, I have this taxonomy assigned to multiple CPTs. While doing the above works just fine, you will see that it will pull all your CPTs together. This can be fine in some cases, but in other cases, you would prefer to have the types of CPTs in seperate sections.

I though, easy, lets just not activate the “use as template” and use the %current_terms% in the query value… it worked perfectly fine in the backend, to then realize that in the front end it would show ALL the posts anyways.. after trying different options for about 1 hour, I decided to contact Crocoblock Support. Veiki replied the morning after with the solution and as always, VERY SIMPLE! (if you know the macros) ;)

So here is how to achieve this:
Create Archive Template

Create a section for each of your different cpts

Add the listing grid widget

Select your previously created listing

Don’t toggle on “use as archive”

In the Post query section choose “tax query”

Select your “taxonomy”

In the operator field, choose “IN”

In the field box, choose “term ID”

In the terms box, insert : %queried_term%

This will basically only call your Listing that has the actual Taxonomy of which we are on .. and as the listing was made for a certain CPT, it will only pull those CPTs ;)

DONE

en_USEnglish

Questo sito fa uso di cookie per migliorare l’esperienza di navigazione degli utenti. Può conoscere i dettagli consultando la nostra privacy policy qui. Proseguendo nella navigazione si accetta l’uso dei cookie; in caso contrario è possibile abbandonare il sito.