Skip Navigation

[Resolved] waqas please display a jude/handler etc

This support ticket is created 4 years, 10 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/Karachi (GMT+05:00)

This topic contains 7 replies, has 2 voices.

Last updated by martinP-13 4 years, 10 months ago.

Assisted by: Waqar.

Author
Posts
#1499821
waaqar 2.png
waqar1.png

im having a few issues building the views for this page here(single-dog) i feel like im missing the same something for all issues.......this is why i have listed all in the same post feel free to split at your disgression. also login details are the same as the main site thanks

1) see image waqas 1
hidden link
it uses content template here hidden link
in there i use
[wpv-view name="view-to-show-person-appearance-in-events-single-dog-page-top" wpvrelatedto="[wpv-post-id item='@event-dog-appearance.parent']"] located here hidden link

i cannot get just the related info of handler and owner for just that dog(i wan to show info for ALL handlers and owners related to this dog and the event where they did so)
...............................................................................................................................................................................................................

2) image waqas 2 hidden link scroll down and expand the box view test dog 2 trial results

again all events handlers /owners/judges showing rather than the handler and owner for that event.
this ct here hidden link then calls hidden link this then shows all handlers/owners for the event rather than just the dogs owner/handler for this 1 event

...............................................................................................................................................................................................................

3)
image waqas 3 hidden link scroll down and expand the box view test dog 2 trial results

you will see the judges section again ALL the same stuff is shown as above how ever i only want to show the persons that JUDGED this event , for this i use
ct here hidden link then calls hidden link which then calls
[wpv-view name="view-to-show-judges-on-a-single-dogs-trial-results" wpvrelatedto="[wpv-post-id item='@event-person-appearance.parent']"].

...............................................................................................................................................................................................................

4) image waqas 3 hidden link scroll down and expand the box view test dog 2 PROGENY trial results

THIS IS JUST A REPEAT OF number 3) but i also just need to show the results id test dog 2 was the sire or dam .

many thnks waqar ive made good headway now and hoe the above is just a simple misunderstanding on my part......

#1499839

also waqar ,this system is much much slicker , it also lets me finsih off the last few bits the previous system could not do , so thnyou for your help and gret support!

#1501795

Hi Martin,

Reading these questions, I feel two important concepts still need some attention and clarification:

1. Scope:

In order to successfully accomplish, what you're planning, it is of utmost importance, that you always understand the scope of the current post.

You can think of scope as a virtual box or container of information about a particular post item.

For example, when you'll use the shortcode "wpv-post-id" ( ref: https://toolset.com/documentation/user-guides/views/views-shortcodes/#wpv-post-id ) that shows the post ID of the current post directly inside the content template "tets" ( a template to show single dog posts ), it will return the ID of the current dog post whose single post is being viewed. This means that here our scope of information is the current dog post.

Likewise, if I'll include a view in this content template that shows all the events posts which are related to the current dog, and in that view's loop item or content template, I'll use the same "wpv-post-id" shortcode, now it will not return the current dog's post ID, but the ID of the current Event post from that view's loop. This means that inside the loop item of that view, the scope has changed to a single event post.

This is how scope works and how the same shortcodes can be made to show our desired information, at different stages, sections or phases. This is the number 1 tip that I'd like to share with you at this point. If you're ever unsure about where you're at and what will be next steps to reach to the required information, just use the "wpv-post-id" shortcode to get the ID of the current post based on the scope and then you'll have clear idea of what to do next.

2. The "item" attribute:
( ref: https://toolset.com/documentation/user-guides/views/views-shortcodes/item-attribute/ )

In your website's single dog page template, you're calling the view "view-to-show-person-appearance-in-events-single-dog-page-top" with "wpvrelatedto" attribute's value coming from this shortcode:


[wpv-post-id item='@event-dog-appearance.parent']

But if you'll use this shortcode on its own, in this content template, you'll see that it will not be able to return any post ID.
( screenshot backend: hidden link & screenshot front-end: hidden link )

If you'll check the documentation on the item attribute ( ref: https://toolset.com/documentation/user-guides/views/views-shortcodes/item-attribute/ ), you'll see that this the format that it supports for showing information from the related post is:

@relationship-slug.role.

This means that in the above example, we're asking the website to get us the ID of parent post which will be an event in the "event-dog-appearance" relationship.

But as we discussed in point 1 above, the scope of information in the single dog page content template is the "Dog" post. Which is why we can't expect the shortcode to return anything, because, at this point, we neither have information about the related event or the dog appearance post. This is Tip number 2, that if something doesn't seem to work as expected, try to break down complex shortcodes and requirements, into smaller bits to see which of the parts are working and what needs to be adjusted.

Summing up what we've discussed so far if I need to get the person posts which have appeared has a handler for the current dog, I'll need to create post view to show "Person Appearance" post where the "Person Appearance Role" custom fields is equal to the "Handler" and the "Person Appearance Dog" custom field is equal to the ID of the current dog.

I hope this makes sense and please let me know if you need any further assistance around the above points.

regards,
Waqar

#1504383

its as clear as mud ha...
can we deal with just number 1 of my questions please as it just is not clear what your answer is for sorry , i want to understand clearly so i can really progress rather than asking a question every night and waiting till the next day to try your answer , as much as i appreciate your help it would be better if i can do it myself and appreciate that this is where this answer is leading.....

1) as you know i didnt use ct lst time i added views to my php files. when i created the ct tets , did this autmatically create the single dogs post VIEW ? and which do i use ? and what is the difference? as i edit 1 the other also changes.

2) so in my ct tets: my goal is to show ALL the handlers and all the owners that have been related to that dog.(scope)

3) i call the view "view-to-show-person-appearance-in-events-single-dog-page-top" i want to change this scope so that it shows all related events to the dog so i would have this: [wpv-view name="view-to-show-person-appearance-in-events-single-dog-page-top" wpvrelatedto="[wpv-post-id item='@event-dog-appearance.parent']"] = now the scope will get the info from my website to set the id of the events related to the dog

4) now in my view "view-to-show-person-appearance-in-events-single-dog-page-top" i would select dog-appearance in content selection to show the events where the relationships are found , and in the queerry i would select wpv id and select the events-dog appearnce relationship (which would set the wpv post-id to the same as ct scope.)

this would now show all the events the dog was realted too ??

i would now make another view and nest it inside to show the person and the role at this event?? if so how ?i dont think im far off undertanding ,but the role and how to select the role of the field type is baffling me?

thanks waqar.

#1506721

Sorry if my last message wasn't clear enough, but I'll be happy to simplify it if you could share exactly which parts are resulting in confusion.

I strongly feel that in our previous interactions, we've put too much focus on the steps to achieve a certain task, without the necessary attention to the concept and logic behind those steps. This leads to reliance on external support for even the most basic tasks and results in a lot of extra time in back-and-forth communication. I apologize for that and moving forward, you'll notice that my emphasis will be on educating you around how different Toolset elements and functionalities work so that you're able to complete your project(s) more efficiently and independently. I hope you'll approve and appreciate this new direction.

With the same objective, I share those two points in my last reply and would reiterate that it is very important that no ambiguity is left around those.

Moving on to your recent questions:

1) "Content Templates" for the single posts work the same way as the "single-{slug}.php" files. The advantage is that you don't have to work with the PHP code and files and you can edit it write from the admin area with HTML and shortcodes.
( ref: https://toolset.com/documentation/getting-started-with-toolset/create-templates-to-display-custom-posts/ )

Any change you'll make in your CT for a single dog post will apply to all single dog pages automatically.

Post Views are different as they're used when we need to show the information from multiple posts or from a different than the current post.
( ref: https://toolset.com/documentation/getting-started-with-toolset/create-and-display-custom-lists-of-content/ )

For example, if you're on a "Dog A" posts single page, and you'll have to show its title, you can directly use "[wpv-post-title]" shortcode ( ref: https://toolset.com/documentation/user-guides/views/views-shortcodes/#wpv-post-title ), in the CT for the single dog post and the "Dog A" post's title will show.

But if you have a requirement to show the titles of different dog posts, for example, Dog B, Dog C & Dog D, etc on the "Dog A" posts single page, then you'll need to include a post view in that CT.

2, 3, 4) This explanation should cover all these questions.

To simplify this requirement, let's write it in plain English and then we'll convert it into view.

"Get all those events which are related to the current dog".

But we're not joining dogs and events directly, and using another post type "Dog Appearances". So the above statement can be broken down into two steps:

a). "Get all those Dog Appearances where Dog is the current dog".
b). "Get all those Events which are connected to the Dog Appearances that we have from the previous step".

In your view "view to show person appearance in events single dog page top", you've correctly selected "Dog Appearances", but the query filter is not correct.
( screenshot: hidden link )

Since you want all those Dog Appearances where Dog is the current dog, you'll select the "Dogs Dog Appearances" relationship.
( screenshot: hidden link )

Next, in your CT for single dog page "tets", you're using the view's shortcode as:


[wpv-view name="view-to-show-person-appearance-in-events-single-dog-page-top" wpvrelatedto="[wpv-post-id item='@event-dog-appearance.parent']"]

But, as explained in my last reply the shortcode [wpv-post-id item='@event-dog-appearance.parent'] means nothing here and would return no value.

You just need to pass the current dog's ID, so you can replace it with "[wpv-post-id]" instead:


[wpv-view name="view-to-show-person-appearance-in-events-single-dog-page-top" wpvrelatedto="[wpv-post-id]"]

As a result, that view will start showing all those Dog Appearances where Dog is the current dog.

Backend-end screenshot: hidden link
( source: hidden link )

Front-end screenshot: hidden link
( source: hidden link )

And since only one event can be attached to each Dog Appearance post, you can directly call its information using the "item" attribute without the need of an additional view.


Related Event's Title: [wpv-post-title item="@event-dog-appearance.parent"]
Related Event's ID: [wpv-post-id item="@event-dog-appearance.parent"]

Screenshot: hidden link

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

#1506789

thanks waqas , its a bit clearer now , to push on from where you leave , i then want to show the the handler and owner at that event , im assuming i would then need a further view to change the scope so i was getting person appearances relating to events and even further along i would then change to person appearances person ?

if i use the field for person how do i selcet which role i want ie handler breeder or judge ?

my objective is on the top of single dog post is to show basicaly all the owners and handlers there have been and at what event, all my work left is literally the same kind of thing , can you make this view do this for me? i feel if i have this one in place it will help me understand fully and serve me as reference point to look at when trying to figure my next ones out. ?

thanks as always waqar.
martin

#1508817

hi waqar , im strugling with the role , how do i specify just a hanlder or just an owner or just a judge? thanks

#1512085

My issue is resolved now. Thank you!