2) Another post reference field in the "race" CPT is "Bana", that connects to the "course" CPT. In the "course" CPT there is a field called "course_distance". Now for each item in the loop in the view "Test" I want to display all the "course_distance" fields that has the same "race_event" from #1.
Example:
a) There are 4 posts in the "race" CPT that are connected to the same event via the "race_event" Post Reference field. In this case the event is called "Tjörnarparen". They only display once, as the view is grouped by the race_event field.
b) Each of those 4 posts are connected to different courses via the "race_course" Post Reference field. In this case the course_distance fields of those connected courses are 50K, 50M, 100K and 100M.
c) In the one list item "Tjörnarparen" I want to display all those four distances.
I have created a view called "Visa alla distanser". But I am not sure how to call that view from the "Test" view, in order for it to display the items for the current list item. With the current code, all the distances of all the posts in the the "course" CPT are listed for each list item in the view "Test". How can I list only those related to the races that share the same event?
In the view "Visa alla distanser" I tried the item='@race_course.parent' parameter, but that displayed nothing. I suppose it may again have to do with the ID vs title of the post reference field?
That groups the races fine and all, but the distances from the course_distance field from the Courses CPT as related via the Post Reference field no longer displays anything. Probably because its values are not sent to the function for the [group-title] shortcode. See attached "upcomingraces-grouped.png"
3) In #1 you can see there were multiple races, each with their own distance, that all have the event name "Tjörnarparen" and the date "8 december, 2018". When all those four races are grouped together in #2 I want to display all those four distances in the now one list item, as in the attached image "upcomingraces-wantedoutput.png". There you can see all the four distances of the four races witht he event name "Tjörnarparen" on 8 december, 2018.
4) As you can see I output both the field "course_distance" and the field "course_time", which may give the wrong output, such as the double "100100". I want to wrap those in a conditional, based on the value in the field "wpcf-course_timeordistance" from the CPT "Courses" that is related via the Post Reference field "race_course". What should be the code for that? I have tried
I took another look at this for you and it is as you say, the field values are not being passed to your custom shortcode. Unfortunately I wouldn't be able to debug this for you as the issue is on the end of the custom shortcode because when not in the shortcode it works fine.
Why not pass all the values into individual shortcode parameter and format it and then print it out ?
"Why not pass all the values into individual shortcode parameter and format it and then print it out ?"
How would I do that? As I need to print possible multiple values for distance for each event title, I would somehow need to loop through all the distances of the courses related to the parent event of the current race. Otherwise only the first distance value will be printed, as the following occurrences of the same event title will not be output due to the [group-title] shortcode.
That is, how can I use shortcode code to loop through all the Course CPT posts that are children of the same Event CPT post that is the parent of the current Race CPT post?
When i say passing the value into the shortcode, i meant doing it like this.
[group-title condition="title" param_1="[wpv-post-field name='wpcf-race_event'] [types field='race_startdate' style='text' format='j F, Y'][/types]" param_2 = '[shortcode]' param_3='[shortcode]'][/group-title].
Please try constructing your shortcode to accept the parameter like this .
Unfortuntely I cannnot provide any debug assistance on this since the issue is not with our shortcodes.