I am trying to hide a parent view only if the nested view is empty. I saw this thread and attempted implementing it, the CSS is hiding the views, but the jQuery mentioned is not "reinstating" them again. I feel like it is some simple syntax I am missing. Would you be able to take a quick look and let me know if there is something I'm missing? The only thing I changed from the snippet in the pasted below thread is the $parent-slug- I changed it to the actual slug.
Thanks for your tip- though it doesn't seem to be working. I feel like I might be putting in the relationship slug incorrectly. Does it make a difference that I have 2 nested views inside the parent/main view? I added the script to both of the children/nested views. For the relationship slug, does that have to be a different slug for each of the nested views?
Can you please share problem URL and admin access details.
*** 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 see you added the display none to top parent view.
Can you please share URL or steps that I should follow so that I should be able to see the no result for the nested view and use it as test case to hide the parent view.
Sure, the URL is dyd.afullsentence.com/dy-directory
Underneath the map is where the loop generally shows up. Now there is nothing because of the display none.
I went into the two nested views, and I added a <script> with the jQuery inside it. See the screenshot attached where I added it in to the loop editor of one of the nested views (I added the same thing into both nested views).
I want to display the result of the main/parent view ONLY when there is something in the nested view - particularly the nested shiurim view. So when the nested shiurim view is empty for any specific parent view, I want it hidden.
To elaborate so you understand clearly, the parent view are the locations on the map. The nested view are speeches that take place in those locations. I only want to display a location where there actually are speeches taking place. If a location doesn't contain a speech, I want it to be hidden from visitors of the site.
The view is showing up now, but the filter still doesn't seem to be working. When I scroll down I still see locations without shiurim inside of them. Also I think something in the code is making the input text search bar not work- when I type in a name of a place in the search bar above the map and I hit the "search" button, it just goes blank.
So that is what I'm asking can you please share few test case that I should use like what value I use for what filter and perform search and what is your expected result with that test case and what should be now. You should share two test case with which you want result and another one for which you do not want to display the result.
Even if I don't use any of the filters and I scroll down the page to view all locations (all posts), I never want to see a location without a shiur (nested view) inside, no matter what.
That is the main thing I am trying to accomplish. Do not display any location that has an empty nested-shiurim view.
I have attached an image where I did not click on any of the filter options and simply scrolled down the page. There you see the middle location says "No Shiurim at this Location. Add one here" - that means there is no nested view, which means that location should be hidden, always no matter what. The other two in the image that I have surrounded in red square, those accordion style dropboxes in the main view location, that is the nested view shiur, and every location that has one of those shiurim inside, that should always be displayed.
Using the filters should just work the same way. If I enter a name of a location (the first filter in the search bar), it should only give back locations that have this nested view (called "shiur") inside of it.
If someone searches for a location and we actually have the location listed in the backend, but it does not have any shiur attached to it, I don't want it being displayed to the user even though they searched for it.