Skip Navigation

[Resolved] One search form for two different views

This support ticket is created 4 years, 10 months ago. 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
- 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)

This topic contains 32 replies, has 2 voices.

Last updated by Franck 4 years, 9 months ago.

Assisted by: Minesh.

Author
Posts
#1485111

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.
hidden link

hidden link

#1486529

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

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.

#1486615

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

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.

#1486645

Ok, so it is not possible to

button 1, display the child posts and i button 2 display only parent posts?

#1486703

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

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.

#1486939

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 :

hidden link

hidden link

Thanks a lot

#1488459

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I still do not understand what you are saying.

I see you shared two links:
=> hidden link and
=> hidden link

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?
=> hidden link

On what link from above you want to add two different search buttons?

#1488517

Hi,

Is the following link displaying the child posts?
=> hidden link

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.

#1488579

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I need to check your current setup and how you configured your both views.

The following page displays the Child.
=> hidden link

The following view displays the parent;
=> hidden link

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.

#1488661

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

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?

#1488673

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

#1488759

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

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.

#1488925

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

There was issue while saving the Layout. I've resaved it and I see the page displays as expected:
=> hidden link

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.

#1488943

Hi thanks Minesh.

I do necessary with plugins

You can find the test page here : hidden link

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

#1489763

Hi Minesh, i don't know what you did, but you break the view : hidden link

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 🙁