Tell us what you are trying to do?
=> I want to hide media slider if there is no image which is child of property post type.
Is there any documentation that you are following?
==> I follwed this suggestion: https://toolset.com/forums/topic/conditional-display-for-one-many-relationship-in-content-template/
But it displays first image then it hides whole slider.
Is there a similar example that we can see?
==> https://toolset.com/forums/topic/conditional-display-for-one-many-relationship-in-content-template/
What is the link to your site?
You can check it here: hidden link
Please suggest how can I solve this issue. I have used this shortcode:
[wpv-conditional if="( '[wpv-post-id item='@property-media.child']' ne '' )"]
Display slider
[/wpv-conditional]
It worked but only displays first slider image and then it goes blank.
Property ==> Parent post type
Property media ==> child post type
One property will have many medias(one-to-many relationship)
Thanks,
Hello,
In your case, it needs a child post view, for example:
In the single "Property" post, display a post view:
- Query "child post type" posts,
- Filter by:
a) Relationship between "Property" and "Property media"
https://toolset.com/course-lesson/displaying-related-posts/#displaying-many-related-items
b) Your custom image field isn't empty:
https://toolset.com/documentation/user-guides/views/filtering-views-by-custom-fields/
- In view's loop, display your sliders
Hello,
Thanks for your reply!
Actually I have already created post view and displayed media images in slider for that property but the issue is that it is displaying no-items text if there is no-medias with current property and I want to hide that text.
That's why I have created conditional statement for slider but it is not working. Can you please take a look here:
Property page with no-media : hidden link
Property page with media: hidden link
Thanks,
You can simply remove that text, for example, edit the page you mentioned above, find and select view block, find and select "View Loop" block, remove the text from option "No Items Found Text", see my screenshot:
hidden link
My issue is resolved now. Thank you!