Skip Navigation

[Résolu] How to hide sorting options when there are no items to be shown

This support ticket is created Il y a 5 années et 2 mois. There's a good chance that you are reading advice that it now obsolete.

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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

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)

Marqué : 

Ce sujet contient 7 réponses, a 2 voix.

Dernière mise à jour par toolset-dave Il y a 5 années et 2 mois.

Assisté par: Shane.

Auteur
Publications
#1336485

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?

#1336871

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

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

#1336977

Hi Shane,

I have tried this conditional shortcode, but it is not working in my case. See lien caché 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.

#1336991

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

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

#1337867

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Screenshot 2019-09-11 at 9.18.36 AM.png

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

#1342215

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.

#1342247

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

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

#1346073

I have filled the feature request, so I closed this thread.