Passer la navigation

[Résolu] How to set initial default dropdown View Output blank instead of all posts

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:

The issue here is that the user wanted to start their search with an empty view and only show the results after the view has been filtered.

Solution:
This can be achieved by wrapping your view output content in a conditional block and then using that conditional block to check if a particular parameter is present in the URL.

Enable the advanced conditional editor for the conditional block and then add this conditional to it.

NOT ( empty( '[wpv-search-term param='wpv_view_count']') ) 

Once you've done this all you need to do is to drag your other view blocks into the conditional. The conditional will only display the results section when you've performed a search and it sees the wpv_view_count parameter.

This support ticket is created Il y a 4 years, 7 months. 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.

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 -

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

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

Dernière mise à jour par ClementB7865 Il y a 4 years, 7 months.

Assisté par: Shane.

Auteur
Publications
#2195997

Tell us what you are trying to do? On page load, I would like the initial results (View Output) of dropdown filter to be blank and only populate with posts after a dropdown selection has been made. Currently the initial default is ALL posts. I've set AJAX refresh when changing any filter.

Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?

#2196223

Shane
Supporter

Les langues: Anglais (English )

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

Hi Clement,

Thank you for getting in touch.

This can be achieved by wrapping your view output content in a conditional block and then using that conditional block to check if a particular parameter is present in the URL.

Enable the advanced conditional editor for the conditional block and then add this conditional to it.

 NOT ( empty( '[wpv-search-term param='wpv_view_count']') ) 

Once you've done this all you need to do is to drag your other view blocks into the conditional. The conditional will only display the results section when you've performed a search and it sees the wpv_view_count parameter.

Thanks,
Shane

#2196905

My issue is resolved now. Thank you!