Accueil › Toolset Professional Support › [Résolu] One search form for two different views
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 |
---|---|---|---|---|---|---|
- | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | - |
- | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | - |
Supporter timezone: Asia/Kolkata (GMT+05:30)
Marqué : Custom search, Views plugin
Documentation connexe :
Ce sujet contient 32 réponses, a 2 voix.
Dernière mise à jour par Franck Il y a 4 années et 9 mois.
Assisté par: Minesh.
Hi,
I would like to do something special. I am not sure it is possible.
I have two different views but with the same search form.
What i like is with one form, have two buttons and one buttons is to query one view 1 and second button query on view 2.
Is it possible easily ?
I explain why i want to do that. I have two pages, one query on childs, one query on childs but display parents, like you can see. It will be better if i can switch just with button.
lien caché
lien caché
Hello. Thank you for contacting the Toolset support.
The link you shared is not opening here. Maybe it requires login.
Do you mean that if I click on button 1, it should display the child posts and if I click on button 2, it should display only parent posts?
I will be able to guide you in the right direction once I review your setup.
*** 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.
The thing is that, normally, you should create a two views, one to display parent posts and one to display the child posts as you are not allowed to filter the parent post based on child post type frontend filters.
I suggest you should go with that approach to create two different page and two views, one view that display parent posts and one view that display child posts.
Ok, so it is not possible to
button 1, display the child posts and i button 2 display only parent posts?
Actually, you can create a view and filter the results for the post type you set to query. To filter parent/child posts using the same view is not recommended because you can not add the parent frontend filters to the child view.
That is why the recommended way is to create a single view for each post type of parent and child.
I know i can not use filter to filter on parent posts (it is the only big problem i found with toolset/wordpress). That is why when i create child posts i use relationship fields and fill them automatically.
And after i just filter on child posts. That works and i have no choice.
But it is not my problem....
Right now my question is : could i use one search filter for two different views which query on the same post type. But one return parent, one return child like this :
lien caché
lien caché
Thanks a lot
I still do not understand what you are saying.
I see you shared two links:
=> lien caché and
=> lien caché
On both links, its using the different views. I still not understand what link you are displaying the child and on what link you are displaying the parent and on what link you want to add the two search buttons?
Is the following link displaying the child posts?
=> lien caché
On what link from above you want to add two different search buttons?
Hi,
Is the following link displaying the child posts?
=> lien caché
YES
I don't understand what is no clear.
I have two views on two different pages. but these views use the same filters, what i want is to offer my visitors one form with two buttons. On button link to one view, one button link to the other view.
I need to check your current setup and how you configured your both views.
The following page displays the Child.
=> lien caché
The following view displays the parent;
=> lien caché
Please correct me if I am wrong.
Please share access details so I can check further.
*** 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 checked and there is no way to filter the results as you want.
You can have two buttons for example "Show Child" and "Show Parent" and there could be a workaround where you can check conditionally what button is clicked BUT both parent and child view's could be added in the same page, not on the different page.
Because you have option to display search results either on same page or different page.
- If we use the option to display the search results on the same page, we can add your another view that displays the parents.
- if we use the option to display the search results on a different page, then yes, you can chose it but then the once you click on the button "show Parent", it will be redirected to the page where you want to display the search results.
so, the only possibility I can see it to display both views results (parent/child) on a single page. Will that work for you?
Yes, it could be work, but will both views be chargend in the same time ? Because maybe it will be too long for the visitor.
How i can do that ?
🙂
Thanks a lot
Can you setup a test page where I can play with and send me the URL and I will work on that on Monday.
I have set the next reply to private which means only you and I have access to it.
There was issue while saving the Layout. I've resaved it and I see the page displays as expected:
=> lien caché
However - After checking to the plugins page, I found that you are using really outdated Toolset plugins. We always recommend to run your site with latest stable release plugin version.
*** Please make a FULL BACKUP of your database and website.***
Could you please update ALL Toolset plugins to it's latest officially released version. You can download the latest plugin release from your accounts page:
=> https://toolset.com/account/downloads/
*** Please make a FULL BACKUP of your database and website.***
Once you update the plugins, please create a test page and send the link to me where I can play with and add the views together.
Hi thanks Minesh.
I do necessary with plugins
You can find the test page here : lien caché
It is the child view. So we would like to add button and parent view, BUT if you think with your solution we need to load the two views in the same time and the button will just be the to display or hide view, don't lose your time because, my search is bit heavy so, i can not load two views.
What i need is, when we click on button 1 the view 1 is load, and when we click on button 2 view 2 is load.
Thanks for your help
Hi Minesh, i don't know what you did, but you break the view : lien caché
Filter doesn't appear anymore, my client is really angry about me, could you please fix the problem.
I created a page and view to do test, i don't understand why you changed this views 🙁