Home › Toolset Professional Support › [Resolved] hide parent if child is empty
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 |
---|---|---|---|---|---|---|
- | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | 10: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/Kolkata (GMT+05:30)
This topic contains 8 replies, has 1 voice.
Last updated by pierre-yvesC 1 week, 4 days ago.
Assisted by: Minesh.
Hi,
This topic has been discussed a few times on other threads but I'm unable to make it work on my site.
I have a nested child view (jobs) within a parent view (organisations).
The nested can be filtered by end-user with a custom field so some parents displays no child.
I wish the Parent posts with no child to be hidden.
This one seemed to be the exact thing but it doesn't work on my side https://toolset.com/forums/topic/exporting-posts/page/2/
Thx
Hello. Thank you for contacting the Toolset support.
Can you please share problem URL and adin access details and let me try to reivew your current configurations and after that I will be able to guide you in the right direction.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
I'm bit confuse after reviewing your structure.
I see you have types of jobs setup as taxonomy as well as custom field as well as you have also custom field added with organizations post types.
Can you please confirm what custom field I should compare with in order to filter the results correctly?
Well, this website is just an example. The real web site I'm working on is much more complicated and uses more custom fields.
So for the actual test website hidden link, here is the structure:
Parent: Organisations
Child: Jobs
Child taxonomy: Type of jobs
My view displays parents (Organisations) and each parent has a nested view for its related child (jobs).
The select filter on top of the page filters Jobs within the nested view.
When the filter is applied, some parents displays no jobs, because their nested view doesn't contain any child fitting with the filter.
I wish those parent to be hidden.
Hope it's more clear.
Thanks again
But then why you use parent view.
You can just use child view and using child view you can display the related associated parent post where entry exists. Will that help?
Hi Minesh,
I already tried it with Child view here https://toolset.com/forums/topic/displaying-related-child/
The help you provided was great but wasn't strong enough for my purpose, it creates doublons.
So I'm trying to achieve it with a parent view.
Thx
(some support tickets I created are not listed in my account, is there a way to find the missing ones?)
Well - it should not create doubleons as its grouping the results based on the parent.
Please check your reply with previous ticket:
- https://toolset.com/forums/topic/displaying-related-child/#post-2807521
You said - it was working exactly as you want, just not in three columns.
If you can implement that - you should be able to see the desired result that is group by parent.
Yes, I said it works and it is.
But it works only in the context of a li
What I want to do is much more complex with address fields, phone number, etc and even some information dipslayed with accordions. You can see it there: hidden link
That's why I tought using a parent view was a better way to do it.
Can you pleae check now:
- hidden link
I've adjsuted the parent view's template output as given undeR:
=> hidden link
[wpv-view name="jobs-2" view_display="layout" parent_title="[wpv-post-title]" kind_of_org="[types field='kind-of-organisation'][/types]"]
And with your child view, I've adjusted the "Loop Editor" output as given under:
=> hidden link
[wpv-layout-start] [wpv-items-found] <div style="padding-bottom: 20px;"> <div style="padding: 10px; border-radius: 10px; background: #ededed"> <h4> [wpv-attribute name='parent_title']</h4> Kind of organisation: <em>[wpv-attribute name='kind_of_org']</em><br> Jobs available: <!-- wpv-loop-start --> <wpv-loop wrap="1" pad="true"> [wpv-item index=1] <div class="row "> <div class="col-sm-12">[wpv-post-body view_template="loop-item-in-jobs-2"]</div> </div> [wpv-item index=other] <div class="col-sm-12">[wpv-post-body view_template="loop-item-in-jobs-2"]</div> [wpv-item index=pad] <div class="col-sm-12"></div> [wpv-item index=pad-last] <div class="col-sm-12"></div> </div> </wpv-loop> <!-- wpv-loop-end --> </div> </div> [/wpv-items-found] [wpv-no-items-found] [/wpv-no-items-found] [wpv-layout-end]
Can you please confirm it works as expected.
Hi Minesh,
It seems you got the clue! Using custom attributes is something I haven't saw before.
Many thx for your help