[Résolu] If a user choose a category or anything in the search form, it not shows correct
This support ticket is created Il y a 5 années. 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.
Les langues: Anglais (English )Espagnol (Español )
Fuseau horaire: Europe/London (GMT+01:00)
Firstly, there are better ways to not show any initial results before a selection has been made than hiding the results with CSS (which means that the results still get sent to the browser).
You can wrap the wpv-loop section of your View in a conditional shortcode which tests for the presence of a URL parameter that gets added when a search filter is applied, and only show the loop when that parameter exists (otherwise it is the first visit to the page and no search has been specified yet).
Now, if I expose the results on your page (by changing the #myresults to display:block) then the results are all in a narrow column on the left. I'm having problems understanding the markup because your View appears to be inserted multiple times (presumably related to the map displayed at the top), and you are using a page builder.
Can I look at your site to see?
I will mark your next reply as private so that I can get log-in credentials from you—you may want to create a temporary admin user for me to use that you can later delete. And be sure to have a current backup of your site.
Les langues: Anglais (English )Espagnol (Español )
Fuseau horaire: Europe/London (GMT+01:00)
OK, the page appears to be working now, and it looks to be working as expected, so I'm not sure any longer what the problem is I'm supposed to be addressing?
The main thing is, I not want, that the results are showing from the beginning. It used to start show, when a customer change anything in the search form (dropdowns, or do a fulltext search).
I did not set anything back or so. It is loading after a few seconds, and then it is loading all the times. But this is not what I want. I just need to get a solution.
Maybe there is something wrong in the Pagination and Sliders Settings or in the Custom Search Settings.
Les langues: Anglais (English )Espagnol (Español )
Fuseau horaire: Europe/London (GMT+01:00)
Something odd with the caching, because when I visited the page the section had the CSS display:none rule set.
In any case, what you describe I would say is expected.
You have turned on automatic pagination that shows 20 results at a time, updating after every 5 seconds.
So, on your initial page load, the condition—which is essentially checking if this is the first time the View has loaded—fails and nothing is shown.
Then after 5 seconds the page updates with automatic pagination, and so now this is not the first time the View loaded, and hence the results are shown.
You could use a similar technique with the wpv-conditional shortcodes, but you would have to add a test for each of the filters you include in the search form (the existing test is for a generic parameter that is added whenever the View results are updated, including with pagination).
Or you could use the wpv_filter_query API filter where you modify the query to return no results unless a search term is specified, which is probably the best solution in this case where you are automatically paginating results, the only limitation being that you need to remove the "No items found" text, so that nothing would be displayed if someone performed a search and there were no results found.