Skip Navigation

[Resolved] one to many view matching on specific field in each type

This support ticket is created 5 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 16 replies, has 2 voices.

Last updated by Luo Yang 5 years ago.

Assisted by: Luo Yang.

Author
Posts
#1382721

Tell us what you are trying to do? one to many view matching on specific field in each type

Is there any documentation that you are following? probably but can't adapt it

Is there a similar example that we can see?

What is the link to your site? n/a

#1382785

Hello,

Please elaborate the questions with more details:

one to many view matching on specific field in each type

How do you setup the post type relationships?
Are we talking about one-to-many relationship?
How do you want to match on specific field in each type?

Here is a document about "How to display related posts with Toolset":
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/

For your reference.

#1382791

thank you for the quick response. I know I've done this a million times but for some reason I can't get things to work. I have a one to many relationship set up but i haven't specifically connected each record in the many with a record in the 'one'. so i want to match based on the text in the field.

One:
ID Organization
123 My Company

Many:
Name Company
Mary My Company
John My Company

View:
Organization (from the one.)
Name (from the many. matching on the text Organization LIKE Company)
Name (from the many. matching on the text Organization LIKE Company)
Name (from the many. matching on the text Organization LIKE Company)

#1382855

Thanks for the details, I assume we are talking about this case:
Two post types
- One
- Many
One-to-many relationship between post type "One" and "Many"

In post type "One", there is a custom single line field "Organization"(Created with Types plugin).
In post type "Many", there is a custom single line field "Company"(Created with Types plugin).

You are going to do this:
In a single "One" post, display all "Many" posts which custom field "Company" values are same as field "Organization" of current "One" post.

If it is, it is possible within Views plugin, for example, you can try this:
1) Create a post view:
- Query "Many" posts
- Filter by:
Select items with field:
Company is a string equal to VIEW_PARAM(company)
- Display "Many" post's information

2) In single "One" post, you can get custom field "Organization" field value within Types shortcode:
[types field='organization'][/types]

Use above field value as view's shortcode attribute value, for example:
[wpv-view name="my-view-slug" company="[types field='organization'][/types]"]

More help:
https://toolset.com/documentation/user-guides/passing-arguments-to-views/#controlling-the-filter-with-shortcode-attributes

#1382939

thanks. i got it up to this point:

2) In single "One" post, you can get custom field "Organization" field value within Types shortcode:
[types field='organization'][/types]

Use above field value as view's shortcode attribute value, for example:
[wpv-view name="my-view-slug" company="[types field='organization'][/types]"]

'my-view-slug' is the slug of the current view?

#1382965

Please replace "my-view-slug" with the post view's slug of step 1)
https://toolset.com/forums/topic/one-to-many-view-matching-on-specific-field-in-each-type/#post-1382855

#1382977

ok - I did try it but it caused the page to hang. i'll try again.

#1382979

It works fine in my localhost, if you need more assistance for it, please provide a test site with the same problem, I can setup a demo for you.

#1382985

not working. can i give you credentials to take a look?

#1382989

I have enabled the private message box, please provide your website credentials and also point out the problem page URL and view URL, thanks

#1383001

please delete - doesn't look like it came through private.

#1383017

I have changed your post to private message:
https://toolset.com/forums/topic/one-to-many-view-matching-on-specific-field-in-each-type/#post-1382991

It seems that you have changed the your website credentials, I get these error when log into your website again:
ERROR: Incorrect username or password.

Please check it, make sure it is valid admin account.

I will check it in tomorrow morning.

#1383031

i changed just to make sure. new one: @F29PAoaSVqN((2A5Jpk2Wex

if there is any way to take a look, or pass to someone else, it would be appreciated. i have a deadline in a few hours.

#1383047

As I mentioned above it needs to be display in a single "One" post(Easy Pass Employer or HOA)
I have done below modifications in your website:
1) Edit the post view "Luo 1", in section "Loop item in Luo 1", remove the view's shortcode:
[wpv-view name="luo-1" eph-community="[types field='epe-community-name'][/types]"]

2) Edit one single "Easy Pass Employer or HOA" post, in post content, display above shortcode:
[wpv-view name="luo-1" eph-community="[types field='epe-community-name'][/types]"]

Test it in front-end, I can see it works fine:
hidden link

#1383049

thank you - something seems to work - i'll try to modify to make it work as needed. please leave ticket open for now. thank you!!