Skip Navigation

[Resolved] Display list with taxonomy terms

This support ticket is created 2 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 5 replies, has 2 voices.

Last updated by Nigel 2 years ago.

Assigned support staff: Nigel.

Author
Posts
#1753949

Hello,

i have created a hierarchical taxonomy called "Orte". Furthermore different terms "Pemba Island", "Unguja", "Mafia Island" etc.

Now I want to output a list of all terms and display it as a slider or list. Only the first level should be displayed here.

In addition, I want to display all subordinate terms in the taxonomy term (e.g. "Unguja"), depending on which term or level I am currently in.

How does this work? Unfortunately I just can't get it to work.

#1755273

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Screenshot 2020-08-25 at 07.52.43.png

You need a View to display the taxonomy terms, and currently you need to use the legacy interface for this, Blocks doesn't include support for taxonomy Views yet (though we hope to add it in the next development cycle)

To display just the top-level terms, you specify the taxonomy in the content selection, and then you add a Query Filter for the Taxonomy parent where you specify the "Parent is none" (i.e. only terms with no parent).

You would use something similar to display the child terms, using a Query Filter for the parent term, but that would depend on what you mean by "which term or level I am currently in".

You can see the available options in the screenshot.

#1756057

Hello Nigel,

thanks for you feedback.
Okay - that was the reason I was not able to find a way. I always used Blocks.

Now I was able to display a list of taxonomy terms on my start page.
But only as a simple list of terms one below the other.

How or where do I have to screw here to make a styled list or even a slider with 3 terms side by side per slide?

The content template has no loop function as far as I have seen?

With "which term or level I am currently in" the following was meant:
I want to output all subordinate terms in the Taxonomy Term.

For example "Zanzibar Unguja" is an island. I want to output all places on the island. The terms linked to the respective subpages (also the subordinate taxonomy terms)

#1756177

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

If you using the legacy version of Views for the first time, you should know that the Loop Editor is an HTML editor that generates the View output where you can add your own HTML or modify the scaffolding HTML as required. Shortcodes are used to create dynamic content, e.g. to output values of custom fields or taxonomies, which can be inserted using the Fields and Views button. There are certain in-built shortcodes (e.g. wpv-items-found) used internally for generating the content which should not be changed.

The easiest solution should be to use the Loop Wizard where you can choose from several output styles and which will generate the required markup for such output. I suggest you try it out, you should hopefully be able to follow how it works.

As for a slider, that can be specified using the pagination settings ("Pagination enabled with automatic AJAX transition").

Regarding your final point, about the subordinate taxonomy terms. The option you choose for the parent taxonomy Query Filter depends on the context of where the View is being displayed. If you are adding it to a taxonomy archive then you can specify that the parent is set by the current archive. Or you might create a View that displays just the top-level terms which creates the context for a second View to display subordinate terms that has a Query Filter where the parent term is set by the outer taxonomy View. You would insert this second View into the output section of the first View.

#1759953

Hello, Nigel,

I have now worked a bit with the old editor and tried around. Works much better for me than the new editor. I was now able to output several search results in the desired form. I still have to test the slider or the view in view thing.

Could you explain to me, just for understanding, what the following variables are?

<wpv-loop wrap="3" pad="true">
Probably indicates that 3 results should be displayed here. What does the 'pad="true"' stand for?

[wpv-item index=1]
Is clearly so far - this is the first result to be displayed

[wpv-item index=other] and [wpv-item index=3]
Probably stand for all results between the first and the last, or represent the last result. Why do we subdivide here?

[wpv-item index=pad] and [wpv-item index=pad-last]
Especially the variables I do not understand. What is this all about?

Thanks for your help.

#1760067

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

There is a description of how wpv-item works here: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-item

It's maybe not the clearest of descriptions.

Ignoring pad and wrap for a moment, here's the simple version of how it works

[wpv-item index=1]
This will be output for the first loop iteration
[wpv-item index=2]
This will be output for the second loop iteration
[wpv-item index=last]
This will be output for the last loop iteration
[wpv-item index=other]
This will be output for all other loop iterations

If you use the Loop Wizard to generate the scaffolding for a Bootstrap grid, you'll see it uses wrap and pad.

Adding wrap essentially turns the index numbers above into 'nth' instead of 'n'.

So when applying wrap, index=2 becomes "every second loop iteration" instead of "the second iteration" etc.

With a Bootstrap grid (or certainly with earlier versions of Bootstrap) if you had a 4 column grid each row needed to contain 4 elements to display correctly, including the final row. If your View returned 13 items, there would be a single item in the final row and it wouldn't display correctly. The pad items are to "pad out" the final row with blanks to replace the missing items.