Navigation überspringen

[Gelöst] Displaying Nested Views

This support ticket is created vor 4 Jahren, 8 Monaten. 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/Karachi (GMT+05:00)

Dieses Thema enthält 5 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von alexG-4 vor 4 Jahren, 8 Monaten.

Assistiert von: Waqar.

Author
Artikel
#1579971

What I'm trying to achieve:

I want to build a site with multiple, related Topics. I want to be able to create multiple hierarchies across the topics, such as

Topic A
Subtopic X
Subtopic Y
Topic B
Subtopic X
Subtopic Z
Subtopic Y
Topic C
Subtopic Y
Subtopic Q

At the moment I'm experimenting with this using Pages to represent all Topics and Subtopics, and Categories as a taxonomy that allows me to define the various hierarchies. So far, so good.

Now I'm looking for a way to display that hierarchy: it should be relatively straightforward, but I keep hitting issues of creating nested Views.

I found the way to inhibit the display of child items in Taxonomy filtered View, so I can now display

Topic A
Topic B
Topic C

I'm now trying to create a nested View to show the next level down. My problem isn't so much figuring out how to configure that View, it's more that I keep being told "Creating Nested Views Is Not Supported".

I've tried creating the View outside the parent, and then adding it in by referencing an existing View (rather than CREATING a View), but get messages saying "The Second View Output Block Has Been removed".

What are the rules for nested views in Blocks?

[I've also considered using Relationships, but I see you've not yet implemented relationships between the same post type]

Alex

#1580935

Hi Alex,

Thank you for contacting us and I'd be happy to assist.

Your observation is correct and the nested views feature is not currently supported in Blocks.
( it is under development though as mentioned at https://toolset.com/2019/11/toolset-views-becoming-toolset-blocks/ )

For now, you'll have to create your views through the classic builder, in such cases and please let me know if you need any assistance around that.

regards,
Waqar

#1580947

OK - thanks for clarifying.

The messaging is confusing: it implies that you cannot CREATE a view nested within a view, suggesting that it's possible to DISPLAY nested views.

But I'm content to use the classic View builder - which I'm more used to!

My issue is resolved now. Thank you!

#1581185

Hi Waqar

I find I DO some help with this, please!

I'm trying to create the nested View that will output the sub-topics. I'm going to need to filter this to show only those posts whose category is a sub-term of the enclosing post's term.

I'm assuming I'll need to use wpv_filter_query for this, and within the code find the taxonomy term of the enclosing post in order to find the child term, and then filter posts based on that.

Where I'm getting stuck is knowing how to find the ID of the enclosing post. I feel sure I've seen how to do this in Toolset, but I just can't track it down!

Thanks

Alex

#1582405

Hi Alex,

Thanks for writing back and sorry about the delay in getting back on this.

If I understand the requirement correctly, you'll need 3 different views for this.

Here are the steps:

1. Suppose this is the structure of the category terms:
( screenshot: versteckter Link )

Topic A
- Topic A-1
- Topic A-2
Topic B
- Topic B-1
- Topic B-2
Topic C
- Topic C-1
- Topic C-2

2. The first view will be a taxonomy view "View to show parent topics", that will show only the parent terms.

It will be set to show the required taxonomy terms, but with a query filter where "parent is none".
( screenshot: versteckter Link )

As a result, you'll have a list of parent topic terms.
( screenshot: versteckter Link )

3. The second view will also be a taxonomy view "View to show child topics", that will show only the child terms.

It will be set to show the same taxonomy terms, but with a query filter where "Parent is the taxonomy selected by the parent Taxonomy View".
( screenshot: versteckter Link )

When you'll nest this second view inside the first one, by placing its shortcode inside the loop, you'll have a hierarchal list of parent and child topic terms.
( screenshot: versteckter Link )

4. The third view will be a post view "View to show posts of the current term", that will show posts attached to the child terms.

It will be set to show the required post type, with a taxonomy query filter where "Categories are Set by the parent Taxonomy View".
( screenshot: versteckter Link )

When you'll nest this third view inside the second one, by placing its shortcode inside the loop, you'll have a hierarchal list of parent and child topic terms, along with the posts attached to those child terms.
( screenshot: versteckter Link )

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1582955

Waqar - that is SO helpful!

Thanks for taking the trouble to lay it out so clearly.

I had to modify it a bit to fit my exact needs (e.g. I don't actually want to display the taxonomy terms), but that was easy to do once I'd understood the principle of starting with two levels of taxonomy-oriented view.

My issue is resolved now. THANK YOU!