Home › Toolset Professional Support › [Resolved] Limiting the data shown
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 |
---|---|---|---|---|---|---|
- | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | - |
- | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | - |
Supporter timezone: Europe/London (GMT+00:00)
Tagged: Views, Views plugin
This topic contains 12 replies, has 2 voices.
Last updated by Nigel 4 years, 9 months ago.
Assisted by: Nigel.
this page here : hidden link
This page uses the view hidden link
this in turn calls "view-to-show-dog-appearances-in-events-single-dog-page" here hidden link
this in turn calls "view-to-show-participation-of-a-person-in-the-results-on-a-single-dogs-results" located here hidden link
the issue : once on this page , scroll down and expand the box "View OFTW dasiypicker test dog 2‘s Trial Results". this will now show the events the dog whos page you are on participated in , this part works fine , if you look at each event it will show different info , the info in question is "OWNER " ,
this now shows all the owners related to that dog , how ever it should ONLY show the owner that is related to that dog for that event only.
thank you in advance
martin
if any more info is required i can supply.
i have the cpt dogs , dog appearences , person ,person appearence.
i enter the dog and then the person , then i attach them to and event using dog apperence and person appearencce.
thanks
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Can I get access to the site to see those Views you linked to?
Let me mark your next reply as private so that I can get log-in credentials from you—you may want to create a temporary admin user for me to use that you can later delete. And be sure to have a current backup of your site.
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
The site you've given me access to is a different one than you were linking to in your opening question, and there is only one dog post and it doesn't have connected data for owners etc., so I can't see the same as in your screenshot.
Is this the best place for me to be looking?
sorry nigel its running on a duplicate site for setup and testing ,same log in details , hidden link
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
I have the set up for your relationships correct, right? In the screenshot?
And the challenge is that the context is a dog post, and you want to display persons connected to that dog (owners), who are also linked to the same event, via the person appearances posts.
I guess dogs can be bought and sold and the owner at one event may not be the same as the owner at another event.
Looking at the specifics of how that owner section is generated...
You have a View (id=20072) that queries the dog-appearances post type.
In the output section of that View you have a nested View (id=20133) which queries person-appearance posts.
The first View passes the ID of the dog in question to the second View using a wpvrelatedto attribute (as well as passing a role attribute).
The second View includes a Query Filter for a custom field "Person Appearance Dog" that should match the ID of the dog passed to the View (as well as a Query Filter for the role custom field).
It is the output of this View which generates the owner fields, so it is this View which needs an additional Query Filter so that it only returns person-appearance posts connected to the same event as the originating dog-appearance post.
So the first of these two Views needs another shortcode attribute, this time to pass the event ID.
You can output the event ID with the wpv-post-id shortcode and the item attribute for the event-dog-appearance relationship, where you need to output the parent ID.
You then add another Query Filter to your second View, a post relationship Query Filter for posts from the events-person-appearances relationship related to the post whose ID comes from the new shortcode attribute you added in the previous step.
how would the shortcode atrribute for the 1st view look ? this is my final issue and is through out the site so if i can get a good understanding here i can complete the remaining issues myself , thank you for your time it is very much appreciated.
martin
if i followed you correctly ,
here hidden link
i added the extra queery
event person appearance related to The post with ID set by the shortcode attribute wvprelatedto
then here : hidden link
i added [wpv-post-id item="@event-dog-appearance.parent"] at the end of **********Owner:<br>[wpv-view name="view-to-show-participation-of-a-person-in-the-results-on-a-single-dogs-results" wpvrelatedto="[wpv-post-id item='@dog-dog-appearance.parent']" role="Owner"]
this doesnt give the desired outcome , so i guessing its something ive done incorrectly? thanks nigel
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
It looks like you have done this a number of times before, but perhaps someone else worked on the site for you.
Here's where in View 20072 you inserted View 20133 previously:
[wpv-view name="view-to-show-participation-of-a-person-in-the-results-on-a-single-dogs-results" wpvrelatedto="[wpv-post-id item='@dog-dog-appearance.parent']" role="Owner" ]
I've formatted it across a few lines so that you can see how it is put together more easily.
You call the View (by name) and then you pass two shortcode attributes to the called View, the first being "wpvrelatedto" which passes the ID of the parent dog post, and the second being "role", where you have passed a string "Owner".
Then in the second View you use these passed values in two Query Filters (screenshot).
What I described above (https://toolset.com/forums/topic/limiting-the-data-shown/#post-1548445) involves doing more of the same. Here's the documentation for reference: https://toolset.com/documentation/user-guides/views/passing-arguments-to-views/
Now, this is what you added where you insert the second View:
[wpv-view name="view-to-show-participation-of-a-person-in-the-results-on-a-single-dogs-results" wpvrelatedto="[wpv-post-id item='@dog-dog-appearance.parent']" role="Owner" ] [wpv-post-id item="@event-dog-appearance.parent"]
You haven't added an attribute to the call to the View, you are outputting the parent event ID after the shortcode that inserts the View.
You are nearly there, but that wpv-post-id shortcode needs to be providing the value for a shortcode attribute that will then be used by a Query Filter in the target View.
You have already added such a relationship Query Filter to that View: Select posts in a Events Person Appearances relationship that are related to the Post with ID set by the shortcode attribute wpvrelatedto.
You have a problem in that you are already using the 'wpvrelatedto' attribute to pass the dog ID, so you'll need to change the name of one of them because they need to be unique.
It doesn't matter what you use for the attribute name, what does matter is that the name you use in the wpv-view shortcode is the same as the name specified in the corresponding Query Filter.
So maybe edit the Query Filter and change the attribute name to something like 'event', and then update where you insert the View (as shown in the code block above) so that your wpv-post-id shortcode is providing the value for that shortcode attribute. (Be careful about mixing single and double-quotes, check how it is for the existing wpvrelatedto attribute.)
thank you Nigel so i my understanding is now correct
in view "20133" i will set my attribute to wpvrelatedto1
in view "20072" i will add the info to get passed as
[wpv-view name="view-to-show-participation-of-a-person-in-the-results-on-a-single-dogs-results"
wpvrelatedto="[wpv-post-id item='@dog-dog-appearance.parent']"
wpvrelatedto1="[wpv-post-id item='@event-dog-appearance.parent']"
role="Owner"
]
If I am now correct , i have never used 2 wpvrelatedto in 1 view before so was a little confused.
is my understanding now correct?? it would make sense, so i hope I have it correct.....
and also if i want to hide owner if there where no results to show would i wrap it in a conditional in view 20072 or 20133?
thank you again
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
That looks correct.
As I said, you can call the attributes whatever you like.
It might help for when you go back to this in 6 months time to update something if you use meaningful attribute names like "dog" and "event", but it doesn't matter as long as the Query Filter is listening to the same attribute name.
If you want to hide the output when there are no matching owners, just delete the "No items found" section from the output of the View (20133), and then when there are no results, nothing will be shown.
brilliant thanks nigel ,i got a whole bunch of the site done with this info, im 99.999999% there now thankfully , i have 2 little issues
on this page here hidden link with "VIEW THE RESULTS OF DOGS OWNED BY TEST PERSON C." expanded i cannot get just the place for the dog to be visible , and the breeder of the dog shows persons that didnt breed the dog.not for the lack of trying....
single peron view is hidden link it calls in
hidden link which calls
hidden link which then calls
hidden link for the place and
hidden link for the breeder
I would really appreciate a pointer , i will even invite you to my party to celerbrate the end of my long long toolset journey.....
thank you so much
martin
New threads created by Nigel and linked to this one are listed below:
https://toolset.com/forums/topic/nested-views-with-relationships/
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Good. Let's close this, and handle the other questions in another thread, which I've split from this one.