Skip Navigation

[Resolved] Creating a custom search using a related post type

This support ticket is created 6 years, 2 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 1 reply, has 2 voices.

Last updated by Minesh 6 years, 2 months ago.

Assisted by: Minesh.

Author
Posts
#1147803

Tell us what you are trying to do?
I have a business post type. Each business has multiple opening times, stored in a related 'opening_times' post type, with the following fields: Day (Mon, Tue, ...), Opening time (12:00 PM). Closing Time (10:00 PM).

I want to be able to search and find all Businesses which are 'Open Today' based on the day, and 'Open Now', based on the current time.

I doubt there is any way to do this using the UI (not that I can find in the documentation anyway). But that's ok, I am proficient in php and api's, but I need to know the best approach.

For example: Can I use the wpv_filter_query filter to alter the WP_Query parameters to perform the search? I have hooked into it, performed a standard filter on the relationship and examined the $query variable, but I can't see how the relationship search works. There doesn't seem to be any $query params that specify the relationship search. It looks like the relationship filter is done earlier. If so, can I hook into that?

I have done this previously using PODS, so I know it can be done, and that I can do it, but there just isn't enough doco on how to perform a custom relationship search.

Is there any documentation that you are following? Have read all of the standard custom search, filter api and relationship doco, but it didn't help.

Is there a similar example that we can see?
Here is my PODS example: hidden link

What is the link to your site?
hidden link

#1147979

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Well - so basically you can display the associated parent when you set your view to query your child posts. I would like to know how you setup your query filters?

*** 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 would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.