Home › Toolset Professional Support › [Resolved] How to hide sorting options when there are no items to be shown
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 |
---|---|---|---|---|---|---|
- | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | - |
- | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | 14:00 – 18:00 | 13:00 – 18:00 | - |
Supporter timezone: America/Jamaica (GMT-05:00)
Tagged: Views plugin
This topic contains 7 replies, has 2 voices.
Last updated by toolset-dave 5 years, 3 months ago.
Assisted by: Shane.
Hello,
I have a View and I would like to hide sorting options when there are no posts. It should display only the message inside [wpv-no-items-found]. Do you have a solution for it?
Hi Dave,
Thank you for contacting our support forum.
You can actually use our conditional shortcode for this.
[wpv-conditional if="( '[wpv-items-count] ' ne '0' )"] Sorting shortcode goes here. [/wpv-conditional]
So this code will only display the sorting controls when the view returns some results.
Thanks,
Shane
Hi Shane,
I have tried this conditional shortcode, but it is not working in my case. See hidden link where I have placed the shortcode [wpv-items-count] with number of items (see Number of items on left side). If you change the filters to not show any items, the [wpv-items-count] will still show the same numbers as before. Custom Search Settings is set to individual - Update the View results only when clicking on the search button - Update the Views results without reloading the page.
Hi Dave,
Would you mind allowing me to have admin access to this site ? As it seems that this view filter isn't working at all.
I've tried to get the view to display no results but the results don't change no matter what I chose.
Thanks,
Shane
Hi Dave,
Thank you for the credentials, I was able to log into the site.
So I checked the issue for you. The problem was that the shortcode [wpv-items-count] needed to be withing the [wpv-items-found] shortcode for your view.
Now this won't work because your sort option is in the filter output. So we wouldn't be able to hide this.
What I recommend is that you use the option in our Views settings to only show the filters that will return a result. See Screenshot
This will ensure that your view will always return an output.
Thanks,
Shane
Hi Shane,
thanks for recommendation, but it does not help me. For example if user writes any number to number field that does not match, it will display the no items message and the sorting options will still be there.
So can I make a featured request for option to hide sorting when there are no items found? Thank you.
Hi Dave,
Yes you can suggest this as a feature request.
You can suggest it through this form here.
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/
Thanks,
Shane
I have filled the feature request, so I closed this thread.