Thanks for the details, here are what I find in your website:
1) The custom field "mirror_ID" is setup in another post type "Karteiköpfe", you can see it here:
hidden link
2) But the post view "TerminFilesIndividual" you are using, it is query another post type "Termine", you can not filter the result by custom fields of another post type, since there isn't any custom fields "mirror_ID" in post type "Termine", so you will get the result: no item found
I suggest you try with a nested views:
1) Parent post view:
- Query "Karteiköpfe" posts
- Filter the result by:
Select items with field:
mirror_ID is a number equal to VIEW_PARAM(users)
- In view's loop, display below child post view:
2) Child post view:
- - Query "Termine" posts
- Filter the result by post type relationship between Karteiköpfe and Termine
- In view's loop, display Termine post information
Then use above parent view in the problem page "View: TerminFilesIndividual"
Hi Luo,
I will try it and report back.
What leaves me puzzled right now: If filtering by a parent post type's field is not possible, then why does the shortcode deliver the corrct result as soon as I watch it as admin? Like I said: the test page using the hard coded value of a mirror ID in fact does deliver the fitting result. Watching the same page as user Lochmann delivers "no items found". The mirror_ID is hard coded on the test page, i. e. it remains the same no matter which user you login as. So the result should be the same all the time, right? Which it isn't.
I had the impression that the relationship feature offered in the filtering section was intended to do exactly that: filter Termine that belong to the parent Karteikopf of a mirror_ID = shortcode attribute value. Else what purpose does relationship based filtering serve?
Followed your suggestions and created Termin4TerminFilesIndividual as a view to be nested inside TerminFilesIndividual.
Same results: no items found
You did not follow my suggestions to setup the post views
https://toolset.com/forums/topic/retrieve-child-posts-via-views-shortcode/page/2/#post-2316025
Please let me know if you need assistance to setup the nested views, I can setup a demo in your website, please backup your website first.
Actually I did, but I changed it in the meantime - maybe before you had a chance to look at it - as an incidental finding raised a suspicion: If I set the filter to show a specific Karteikopf instead of dynamically fetching it via a relationship the following happens: a dropdown opens that is supposed to show all Karteikopf posts to select from. But only a minority appears.
So I've changed the view twice to show all Termin posts and all Karteikopf posts respectively without any filtering to make sure the view itself catches everything with filters off, which it does.
My question now: does Toolset only search thru public posts while ignoring private posts? If so, is there a way to allow search for private posts as well? For data protection purposes patient files are all set to private and each patient is given access to posts related to him / her only.
For the new question:
does Toolset only search thru public posts while ignoring private posts?
Toolset post view is using WP_Query class to database, will query published post by default see WP document:
https://developer.wordpress.org/reference/classes/wp_query/#status-parameters
post_status (string / array) – use post status. Retrieves posts by post status. Default value is ‘publish‘,
And you can follow our document to setup the post status filter, add more other status posts
https://toolset.com/documentation/user-guides/views/filtering-views-query-by-post-status/
Bingo, man, that was it !!! Status set to any on a second filter in both views and everything goes smooth now. Thank you so much for those 2 links.
Kindest regards,
Sven
My issue is resolved after setting up an additional filter to unlock any post status for the query. Thank you!