Skip Navigation

[Résolu] Need help with nested views

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 11 réponses, has 3 voix.

Last updated by garyH Il y a 7 années et 6 mois.

Assigned support staff: Caridad.

Auteur
Publications
#212670
Screenshot 2014-04-19 13.17.18.png

Hello,

I need help with what seems to be a simple matter, but I have not been able to figure it out.

I have a restaurant review site with pages for each restaurant that have both a "city" and a "state" custom taxonomy. I want to set up an index page that lists all restaurants with the hierarchy State > City > Restaurant (post). I have set up 3 views: (1) a posts view for the restaurants, (2) a taxonomy view for cities, and (3) a taxonomy view for states. Each works except the the States view. I have not been able to figure out how to set up the filters so that only the restaurants in each state appear under that state. As it is, I get all of the cites & restaurants under each state.

I've attached a screenshot showing the output I get from each of the 3 views that I have set up. Any help would be appreciated.

Thanks,
Gary Henry

#212887

Dear Gary,

You should try setting up nested Views like its explained in this article:

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

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

Regards,
Caridad

#212899

Hi Caridad,

Thanks for your response. In originally setting up my nested views, I went over the article you mentioned many times, but I am still not getting the desired results. I am missing something, but can't figure out what it is.

Gary

#212950

Gary,

I've ran up against a similar Views problem as well and posted about it. In my case, the tutorial that Caridad pointed you to (and me) only deals with using taxonomies as "group y" headings. My issue was wanting to use post types. See my past thread here: https://toolset.com/forums/topic/query-and-display-posts-with-tags-from-different-taxonomies/

Like in Drupal, you probably are looking for a "Group by" feature that allows for filtering at various levels. This does the heavy lifting and gets rid of repetition of headings, etc. Otherwise, in WordPress Views you need to nest and filter and it gets very difficult to manage, very quickly.

I was told that "Group by" was coming, but like all software dev, I only believe it once I see AND try it. Hopefully, Views will support this much needed feature soon, and make it elegant and simple to use. Until then, I'm stuck in Drupal Views 3 land for controlled "grouped-by" listings that are dead simple to set up.

Not much help, I know, but perhaps my post will motivate the dev's to push this feature out the door sooner rather than later.

Matt D

#212952

Thanks for you input, Matt. Glad to know that I was not overlooking something simple in the set-up of the views. I can't leave WordPress for Dupal, so I guess I'm stuck for now.

Gary

#213064

Dear Gary,

Do you want to give me access to your Dashboard so we can work together towards a solution? You can use the boxes below the comment area, after you agree to the disclaimer.

Regards,
Caridad

#213167

Yes, that would be great. Thanks! I have set you up with access to my staging area at WP Engine.

What I am wanting is this:

Level 1 (taxonomy view) = States

Level 2 (taxonomy view) = Cities

Level 3 (posts view) = Restaurants

The page that I want this on is "Restaurant Reviews." I have included all three views on that page, in descending order, so you can see the output we are getting from each view.

As you can see, the bottom two views are outputting correctly, but I can't seem to get these to nest correctly under the topmost view, "States."

Any help would be appreciated. Experiment away -- this is only a testing site.

Thanks,
Gary

#213402

Dear Gary,

I have been playing around with the setup but there is something that I am missing. How to find out which cities belong to which states? There is no way of setting such a relationship between two taxonomy terms.

So I have been thinking on an alternative solution, the idea is to use 2 views: a states view and a restaurants view. The restaurants view will list restaurants that belong to a state, and it would show the city.

If you use a single hierarchical taxonomy called for example “Locations?? then it might be easier to do what you need.

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

Regards,
Caridad

#213426

Thanks, Caridad.

The approach you suggest is actually one that I tried early on. There was something about it that was not exactly ideal for my purposes, but I can't remember now what that was. Let me go back and set that up again and do some testing, and I'll get back to you.

Thanks for your work on this.

Gary

#213519

Caridad,

I've been attempting to set this up today, but still haven't figured it out. I think I am more confused than when I started!

I guess I'm not clear on what you envision with the two views you suggest. How would each be filtered, and how would they be nested?

Gary

#213686

Dear Gary,

The main View (States) is inserted directly into the page. The second View (Restaurants) is a child VIew, so its inserted in the main's View Layout area.

Its already setup this way on your staging site, so you can see it directly in the restaurants page.

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

Regards,
Caridad

#213729

Wonderful. This will work. Thanks so much for your perseverance!

Gary