Skip Navigation

[Resolved] Search field by custom fields from other connecting post

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.

Our next available supporter will start replying to tickets in about 6.70 hours from now. Thank you for your understanding.

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 13:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Sao_Paulo (GMT-03:00)

This topic contains 5 replies, has 2 voices.

Last updated by Tien Nguyen 1 year, 3 months ago.

Assisted by: Mateus Getulio.

Author
Posts
#2630055

Tell us what you are trying to do?

I have 2 post types: "Room" and "Vacation for Sales" in the relationship one-to-many.

Post type "Room" has custom field "Kind of Room" (Apartment, Villa, ...). With post type "Room", I created some posts, for example: "A Resort Apartment", "A Resort Villa", "B Resort Apartment", "B Resort Villa".

In the view at the archive page of "Vacation for Sales", I want to create a search field by custom field "Kind of Room" (from "Room" posts), so that I only see "Apartment", "Villa". When I choose "Apartment" and search, it will just show some post "Vacation for Sales" connecting with "A Resort Apartment", "B Resort Apartment".

How can I do that?

Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?

hidden link

#2630107

Mateus Getulio
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Hey there,

Thank you for contact our support.

Here's a basic roadmap to achieve it using Toolset:

- Firstly, ensure that a one-to-many relationship between your "Room" and "Vacation for Sales" post types is correctly established. You can confirm this by navigating to the Toolset dashboard, and selecting Toolset -> Relationships.

- Once the relationship is set, the next step is to create a new View that will display your "Vacation for Sales" posts on the archive page. To do this, go to Toolset -> Views, click on "Add New" and select "Vacation for Sales" as the post type that the View should display.

- Finally, add a search field to your newly created View. This search field will filter the displayed posts based on the related "Room" post's "Kind of Room" custom field. To do this, click on the "Search" section of the View editor and then click "Add a search field". From the list of available filters, select the "Kind of Room" custom field.

Please test it and let us know if you find any issues implementing it.

Best,

Mateus

#2630167
2023-08-04 (6).jpg
2023-08-04 (4).jpg
2023-08-04 (3).jpg
2023-08-04 (2).jpg
2023-08-04 (1).jpg
2023-08-04.jpg

Phòng: Room
Tin bán: (Vacation) for Sales
Loại phòng: Kind of Room

I have set the relationship.

I don't see Toolset/View, but I created a view on the archive page of "Vacation for Sales". In the view on this archive, I added search filed Loại phòng (Kind of Room). But in front-end, it's empty for choosing, while it still shows in the loop.

I have uploaded some photos for your checking.

#2630575

Mateus Getulio
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello,

I would like to request temporary access (wp-admin and FTP) to your site to take better look at the issue. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Our Debugging Procedures

I will be checking various settings in the backend to see if the issue can be resolved. Although I won't be making changes that affect the live site, it is still good practice to backup the site before providing us access. In the event that we do need to debug the site further, I will duplicate the site and work in a separate, local development environment to avoid affecting the live site.

Privacy and Security Policy

We have strict policies regarding privacy and access to your information. Please see:
https://toolset.com/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

**IMPORTANT**

- Please make a backup of site files and database before providing us access.
- If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this: hidden link

Please, let me know if you need any additional details. Have a nice day.

#2631573

Mateus Getulio
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Hi,

Thank you for sharing that info.

Based on the scenario you've described and on my tests and debugging, creating the search filter by using a custom field from one custom post type (CPT) "Room" on the archive page of another CPT "Vacation for Sales" might be challenging without custom code.

By what I could investigate, there are two possible approaches to achieve what you want:

Workaround using existing CPTs: You can add the same custom field "Kind of Room" (Apartment, Villa, etc.) to the CPT "Vacation for Sales". This way, when you create a "Vacation for Sales" post, you can manually select the corresponding "Kind of Room" that it relates to. It might not be as streamlined as pulling the information directly from the "Room" posts, but it will enable you to create the search filter you desire.

Custom Code Solution: If the workaround does not suit your needs, creating a custom code to link the "Room" posts with the "Vacation for Sales" posts could provide the solution. This would require an in-depth understanding of WordPress development, PHP, and possibly JavaScript.

Please have in mind that giving support to custom code is out of the scope of this forum. The hints I shared could point you in the right direction, but we can't create, debug or modify custom code for you and it's your responsibility to maintain it.

If implementation becomes a roadblock, you might want to explore the list of Toolset Contractors for assistance: https://toolset.com/contractors/

Kind regards,
Mateus

#2631765

I understood. Maybe I have to choose the method of using direct CPTs and hope Toolset providing this feature in the future. Thank for your help.