Skip Navigation

[Resolved] displaying taxonomy lists

This thread is resolved. Here is a description of the problem and solution.

Problem:

I attempted to try a nested view search with taxonomy as parent, using Main topic as parent, it did not work.

I attempted to try to use a post search with main topic as the query filter and then displaying all subtopics, it did not work.

See details here:

https://toolset.com/forums/topic/displaying-taxonomy-lists/#post-1110544

Solution:

it needs three levels nested view. For example:

https://toolset.com/forums/topic/displaying-taxonomy-lists/#post-1112036

Relevant Documentation:

This support ticket is created 6 years, 3 months 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 8 replies, has 2 voices.

Last updated by Luo Yang 6 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#1109622

This page: hidden link

I have one view that finds all taxonomy called Main Topics

I am trying to have a second view that will find all taxonomy called Sub Topics filtered by Main Topics.

The taxonomies are not hierarchical or parent-child taxonomies. They are two separate taxonomies used across multiple CPTs.

I've attempted different ways of filtering and this is the closest I've come to under the (click here to view all topics under Education link) --- but I do not know how to group that taxonomy and show a count.

Thanks.

#1110328

Hello,

Please elaborate the question with more details:
I am trying to have a second view that will find all taxonomy called Sub Topics filtered by Main Topics.

Are we talking about this:
taxonomy "Topics", with terms:
- term A
- term B
- term C
taxonomy "Sub Topics", with terms:
- term B
- term C
- term D

You are going to display term's of taxonomy "Sub Topics"
- term B
- term C

display those "Sub Topics" terms which term's title are existed in "Topics".

If it is, you can create a taxonomy view, list terms of taxonomy "Topics", in the view's loop, use [wpv-conditional] shortcode to check if current term existed in taxonomy "Sub Topics", if existed term with the same title, then display it.
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/displaying-taxonomies-conditionally/#specific

#1110544

Hello!

No. They do not share the same terms.

Taxonomy Topics:
Term 1
Term 2
Term 3
Taxonomy Subtopics
Term A
Term B
Term C

So, some posts may look like this

Post 1A:
Term 1
Term A

Post 2A:
Term 1
Term B

Post 3A:
Term 2
Term B

Post 4A:
Term 3
Term C

So I want to create a list that will show

Term 1
Term A
Term B

Term 2
Term B

Term 3
Term C

I attempted to try a nested view search with taxonomy as parent, using Main topic as parent, it did not work.

I attempted to try to use a post search with main topic as the query filter and then displaying all subtopics, it did not work.

#1111329

It should be possible with a nested view,
1) Parent taxonomy view, list terms of taxonomy "Topics"
2) Child posts view, filter by:
Select posts with taxonomy:
Topics set by the parent Taxonomy View
and display the Subtopics terms:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-taxonomy

More help:
https://toolset.com/documentation/user-guides/using-a-child-view-in-a-taxonomy-view-layout/

If you still need assistance for it, please provide a test site with the same problem, also point out the problem page URL and view URL, I can setup a demo for you.

#1112036

For the question:
You can see how it lists all the sub topics but it is repeated, rather than showing only one.

This is expected result, for example view "Deaf Education Subtopics"
hidden link

it is a post view, in section "Loop Editor", you can add the post link shortcode insider the view's loop, test it in front-end:
You should be able to see there are three posts are using same "Subtopics" term "Alternative Teaching Methods", so it conduct the problem: it lists all the sub topics but it is repeated.

In your case, it needs three levels nested view.

For example:
1) Top level view:
hidden link
list all terms of taxonomy "Subtopics",
In view's loop, display 2nd level view, and pass the Main topic + Subtopics:

[wpv-view name="child-post-view-2" maintopics='[wpv-attribute name="maintopics"]' subtopicsid='[wpv-taxonomy-id]']

2) 2nd level view:
hidden link
query posts of custom post types, filter by:
- Select posts with taxonomy:
Main Topics slug in one of those set by the View shortcode attribute maintopics
eg. [wpv-view name="view-name" maintopics="xxxx"]

- Sub Topics set by the parent Taxonomy View

In view's loop, display the 3rd level view, like this:

  • [wpv-view name="get-the-term-information-by-id" subtopicsid='[wpv-attribute name="subtopicsid"]']
  • 3) 3rd level view:
    hidden link
    list term's of taxonomy "Subtopics"
    filter by:
    Taxonomy term ID is set by the shortcode attribute "subtopicsid"
    and display the term's link: [wpv-taxonomy-link]

    4) Create a page, display the top level view as below:

    Deaf Community:
    [wpv-view name="deaf-education-subtopics-2" maintopics="deaf-community"]
    
    <hr/>
    
    Deaf & Development:
    [wpv-view name="deaf-education-subtopics-2" maintopics="deaf-development"]
    
    <hr/>
    
    Deaf Education:
    [wpv-view name="deaf-education-subtopics-2" maintopics="deaf-education"]
    
    
    

    hidden link

    Test it in front-end:
    hidden link

    Please check if it is what you want. thanks

    If we use four levels nested view, it might conduct the performance problem, and there are not too much term in "main topic" taxonomy, so I suggest you setup the views shortcode attribute manually in the wordpress page.

    #1112247

    Great! Yes that's what I'm looking for.

    If I wanted to add a count of the posts in each sub topic taxonomy, which level view do I put that in?

    #1112474

    You can put the post count shortcode [wpv-items-count] in the loop of 2nd level view
    https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-found-count

    #1113140

    My issue is resolved now. Thank you!

    #1114582

    You are welcome.