Skip Navigation

[Resolved] Conditional Ooutput -Comparing Two Custom Post Types Without Post Relationship

This support ticket is created 6 years 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 5 replies, has 2 voices.

Last updated by Luo Yang 5 years, 12 months ago.

Assisted by: Luo Yang.

Author
Posts
#1148095

Tell us what you are trying to do?

I have two custom post types, Houses and Buyers. I am trying to compare a custom field (house-type-house) from custom post type Houses to (house-type-buyer) from custom post type Buyer.

I'd like to create a view that for example when I select a buyer lists all the houses that meet their criteria based on their set of custom fields.

I appreciate that post relationships can do this if I manually link each buyer to a house but that's not practical.

I would like one company to be able to log in and list a property and then have a view with "Recommended Buyers" built into the content template once it's created and vice versa I'd like another company to list a buyer and then have a view with "Recommended Houses" built into their content template.

Is this possible, I feel it is but can't figure it out?

#1148987

Hi,

How do you setup the custom fields "house-type-house" and "house-type-buyer"?
If they are multiple choices custom checkboxes fields, I suggest you use a custom hierarchical taxonomy "house-type" to replace it:
https://toolset.com/documentation/user-guides/create-custom-taxonomies/

Register taxonomy "house-type" to both post types:
- house
- buyer

In a single "buyer" post, you can create a nested view:
1) Parent taxonomy view, query terms of taxonomy "house-type", filter by terms assigned to current post
2) Child post view, query posts of "house" post type, filter by "house-type" term from parent taxonomy view.

More help:
https://toolset.com/documentation/user-guides/using-a-child-view-in-a-taxonomy-view-layout/

#1149197

Ah brilliant, thanks Lou, this is a great start.

Would it be possible to take this one stage further and filter the results more based on a radius of the post types respective address fields?

#1149654
#1152444

I'm not too sure if it is resolved but I'm parking the issue for a while. Would it be possible to keep the ticket open? No problem if not.

#1152884

OK, please update this thread if you need more assistance for it, thanks