In my many to many relationship I am able to query the camps that belong to a particular venue. (what-i-have-now.jpg) I would like to add to that by sorting this list in a specific way.
1) Each camp as an assigned custom taxonomy (camp-type ie: technology, creative, educational, etc.)
2) I would like to group this list by camp type.
3) I would prefer not to have this query in a single view because the groups of camp-types have to be in specific static order and have different CSS classes applied to the elements.
4) So my query would be: Select camps that belong to current venue grouped by camp-type ordered by camp name (camp name is a link).
The second last guide is useful in an event, when you want to grab some information from a parent post, within the child post. While the last guide link is useful when you don't want to rewrite the same output for multiple views or want to use a common output code for multiple views.
Hello, I am still having trouble writing the correct view.
With your help I was able to select all camps and group by camp-type taxonomy. (list-camps-group-by-category.png) hidden link
With the many to may relationship I have set up, Camps, Sessions, Venues
I was able to create this view that lists camps that belong to a specific venue (list_venu_camps_view.jpg & camps_view.jpg) hidden link
However, I can't figure out how to group this list by camp-type taxonomy as i did in the first link above.
Unfortunately Waqas is off today. He will be back on Monday. This is Minesh here to help you further, hope this is OK.
I would like to have access of your install in order to have a better understanding of your post structure.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).
I have set the next reply to private which means only you and I have access to it.
I created a demonstration for you and have added some visual stuff to make it self-explanatory. I have also used just titles of the posts to keep it simple.
Please see following 4 views created in Dashboard -> Views:
- Toolset: Camp Types
==> This is simple taxonomy view
==> showing all Camp Types
==> and is a parent view for "Toolset: Camps".
- Toolset: Camps
==> This loops through CPT "camps"
==> with a filter "Camp Types set by the parent View"
==> and is a parent view for "Toolset: Sessions".
- Toolset: Sessions
==> This loops through Intermediary CPT "sessions"
==> with a filter "Select posts that are a children of the Post set by parent View"
==> and is a parent view for "Toolset: Venues"
==> but with little extra record keeping. It passes the Camp ID to the "Toolset: Venues" as below:
- Toolset: Venues
==> This also loops through Intermediary CPT "sessions"
==> with a filter "Select posts that are children of the Post with ID set by the shortcode attribute wpvprchildof" (notice wpvprchildof attribute as mentioned in above code also). This attribute is received here and contains the Camp ID.
==> and displays the Venue Title as below:
The last 2 views are important to understand. Both loop through that Intermediary Object but behave differently. Since "sessions" is a child to both Camps and Venues, we can easily loop on the sessions, but can refer to their parents using that id="$venue" or id="$camp" attribute in the view short codes.
I hope, I have explained in detail and you can understand it easily.
Le sujet ‘[Fermé] Having trouble creating a complex many to many sorted list’ est fermé à de nouvelles réponses.