Skip Navigation

[Resolved] Split: Post relationships not showing on the front end – filter by custom field?

This thread is resolved. Here is a description of the problem and solution.

Problem:

Filter view's result by custom field shortcode.

Solution:

You can pass custom field shortcode as view's attribute.

Relevant Documentation:

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

This support ticket is created 4 years, 8 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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 24 replies, has 3 voices.

Last updated by nicoleR-3 4 years, 7 months ago.

Assisted by: Luo Yang.

Author
Posts
#1544177

Okay. Thank you.

I do have one other question. Is there a way to return results without using relationships between posts, for instance by using a specific field. For example, if I want to automatically return all offspring results for a particular dam by referring to the field "Dam" for each horse? Is there a way to set up a view like that?

#1544209

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Do you mean that you want to filter your posts using the custom field value? If yes, you can add a Query Filter from the Query Filter section of your view and add a custom field filter.
=> https://toolset.com/documentation/user-guides/views/filtering-views-by-custom-fields/

If this is not what you are looking for, please share example with brief description that will lead me to guide you in the right direction.

#1545035

Yes, thank you. This is getting me closer. But how do I set it up so it matches the correct offspring with the correct sire/dam? So far I have not been able to do it. I can either limit offspring to one dam that shows up on all pages or multiple offspring that show up on all horse pages but are not matched to the horse page they are appearing on.

So, for instance, only Desired Millicent's offspring should appear on her page. Only Mistazah's offspring should appear on her page. And so forth.

Sorry, but I've always had trouble making sense of parameters. I have plugged several different variables in this far, but am not getting the results I want.

#1545419

Hi,

Minesh is on holiday, will be back tomorrow, you will get answer when he is back.

#1546897

Minesh
Supporter

Languages: English (English )

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

So, for instance, only Desired Millicent's offspring should appear on her page. Only Mistazah's offspring should appear on her page. And so forth.
==>
I would like to know how we can identify that what are the desired offspring posts you want to display? Can you please share example?

#1547655

I have custom fields for "Dam" and "Sire", so I would like to use those custom fields in the view to filter the results. So any horse with "Dam" designated as "Desired Millicent" would show up on her page under offspring, and any horse with "Dam" designated as "Mistazah" would show up on her page under offspring. And so forth. Does that make sense?

#1548169

Minesh
Supporter

Languages: English (English )

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

What if you add a custom field filter from the "Query Filter" section of your view and select/add the Dam custom field filter and assign the value to it "Desired Millicent" and save the filter:
Please check the following screenshot => hidden link

Is this what you looking for?

More info:
=> https://toolset.com/documentation/user-guides/views/filtering-views-by-custom-fields/

#1548837
Screenshot_2020-03-12 Mistazah -.jpg
Screenshot_2020-03-12 Escapade SHF+ -.jpg
Screenshot_2020-03-12 Desired Millicent -(1).jpg

Yes, I did that. But then it returns Desired Millicent's offspring on all the horses' pages. So Desired Millicent's offspring appears on Mistazah's page or even on horse pages where there shouldn't be any offspring at all. See attached for how the results now appear on all horses pages. Is there any way to set up the filter so it matches the offspring dam name to the corresponding horse page?

The idea is to match the offspring with the correct parent.

#1548863
Screenshot_2020-03-12 Edit View ‹ — WordPress.png

Here is the query setting.

#1549981

Minesh
Supporter

Languages: English (English )

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

Can you please share the links of your horses pages where the Desired Millicent's offspring should be displayed and the horse page where it should not be displayed.

#1550237

This is the only page that should have Desired Millicent's offspring: hidden link

None of the others should have it, though they all do. Desired Millicent is the only one that can have Desired Millicent's offspring. What I would like to do is be able to make a view where the dam field is matched to the corresponding horse page. Is there a way to do that?

Pages that SHOULD NOT HAVE Desired Millicent's offspring:
hidden link
hidden link
hidden link
hidden link
hidden link
hidden link

Arose to Nobility is a neutered male, so he doesn't have any offspring
Escapade is also a neutered male, so no offspring.
Jassirah is too young, but may eventually need to have her own offspring showing on her page.
Mistazah has her own offspring that needs to show on her page. Currently Desired Millicent's offspring is showing.
Nile Rose should be showing her own offspring on her page, not Desired Millicent's.
Suracommander is a neutered male and doesn't have any offspring.

#1551999

Minesh
Supporter

Languages: English (English )

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

With the post you shared: hidden link

I already see it's displaying the related post "Finneas RZ" under the Offspring section with the above page.

Do you mean that if the post title equal to custom field Dam value, even though you are on the same horse page "desired-millicent" you still want to display the post "desired-millicent" under the Offspring section?

#1560539

Yes, it's correctly displaying on Desired Millicent's page. The issue is that Desired Millicent's offspring are displaying on all the OTHER pages as well, when what I want to do is get the filter customized so each dam is matched with her offspring .

#1562679

Minesh
Supporter

Languages: English (English )

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

Sorry but authorization access details are not working at this end. Can you please send me authorization access details so I can able to load the site.

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

#1568159

Minesh
Supporter

Languages: English (English )

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

Thanks for sharing access details.

I still wonder why you added the conditional statements using the [wpv-conditional] shortcodes to different raws to the following content template you build:
=> hidden link

I took one screenshot that might be useful to confirm the issue with you. As you can see with the following screenshot:
=> hidden link
- You want to match the post title with the Dam field value of the related post and if post title equal to dam field value than and then we should display that related post under the Offspring section - correct?