[Closed] Many to Many Relationship display brother fields in another post

This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

You are not logged in. You can view support threads, but not post.
If you are already logged in, please refresh your browser.

Related documentation: WordPress custom search with Toolset

This topic contains 11 replies, has 2 voices, and was last updated by  Noman 2 months ago. The support staff assigned to this topic is Noman.

Viewing 12 posts - 1 through 12 (of 12 total)
Author
Posts
#556013

Tell us what you are trying to do? Display brother custom fields in another post.
I have two parent posts Colleges & Consultants - with custom field of country in both

I have one child post of both -- Common

I have created two views as the instructions.

I want to display all the consultants belongs to particular college in college post type but with the option of country custom field as drop down so that I can find all the consultants in one country for the particular college.

Is there any documentation that you are following? Yes. https://wp-types.com/documentation/toolset-training-course/part-9-many-to-many-relationships-in-toolset/

Is there a similar example that we can see?

What is the link to your site? http://ram1-23189-tbs-1.discover-wp.com/college/uk-college2/

#556039

Noman
Forum moderator

Supporter languages: English (English )

Supporter Timezone: Asia/Karachi (GMT+05:00)

Hi Ram,

Thank you for contacting Toolset support. Looks like you want to create a Search view where user can filter the consultants using Country dropdown.

You can create Custom search view for Consultant Post type, please follow this doc:
https://wp-types.com/documentation/toolset-training-course/part-7-custom-search/

More info: https://wp-types.com/documentation/user-guides/filtering-views-by-custom-fields/

The requirements you have provided are not clear. Please provide us:
1. Step by step details of what you have done to at the back-end? (preferably with backend screenshots)
2. What you expected to see on the front page?

Thank you

#556344

Hi Noman

I referred to these 2 posts:
https://wp-types.com/forums/topic/parametric-search-filtering-by-parent-types-field/
https://wp-types.com/documentation/toolset-training-course/part-9-many-to-many-relationships-in-

toolset/

Here are the steps I taken:

Create Post Type College with Country as a custom field - Added some posts
Create Post Type Consultant with Country as a custom field - Added some posts

Create Post Type Common -- is a child of College & Consultants -- Created some relationship post
with colleges and consultants. I am able to display colleges using the Country custom field dropdown in college post and also consultant using the Country custom field dropdown in consultant post. I am also able to display all consultants for particular college and all colleges for particular consultant but wanted to filter by country dropdown.

I have created 2 views:

Child View -
Display all results
Content Selection - Common
Query Filter: Select posts that are children of the Post where this View is shown.

Loop Output Editor:

[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->

<wpv-loop>
[wpv-post-link id="$consultant"]
</wpv-loop>

<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]

Filter and Loop Output Integration Editor:

[wpv-filter-meta-html]
[wpv-layout-meta-html]

2nd View Location-Parent:
Display the results using a custom search
Content Selection - Consultants
Custom Search Settings : AJAX results update when visitors change any filter values

Filter Editor:
[wpv-filter-start hide="false"]
[wpv-filter-controls]
<div class="form-group">
<label>[wpml-string context="wpv-views"]Country[/wpml-string]</label>
[wpv-control-postmeta field="wpcf-country" url_param="wpv-wpcf-country" type="select"

auto_fill="wpcf-country"]
</div>
[/wpv-filter-controls]
[wpv-filter-end]

Loop Output Editor : Here's I am using the child view

[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<wpv-loop>
[wpv-view name="child"]
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]

Filter and Loop Output Integration Editor
[wpv-filter-meta-html]
[wpv-layout-meta-html]

I got the filter to display but its not working because it shows all the consultants regardless the
country you select. In this particular example :
http://ram1-23189-tbs-1.discover-wp.com/college/uk-college2/

This college has 2 consultants each from UK & USA. Its display both the results regardless the selection. I would like to display only UK consultants when selected UK & USA Consultants only when selecting USA and no items when selecting India.

#556462

Noman
Forum moderator

Supporter languages: English (English )

Supporter Timezone: Asia/Karachi (GMT+05:00)

Hello Ram,

I need to take a look at your setup and to request temporary website WP-admin and FTP info for your site to debug further and to help in resolving this. Your next answer will be private which means only you and I have access to it.

=== Please backup your database and website ===

✙ I would additionally need your permission to de-activate and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important.

✙ Please add the Links to the [View] Edit Screen.

Thank you

#556479

You have my permission to do anything inside the site.

Here's the link for the view edit link:

[credentials-removed]

Reference Site : http://ram1-23189-tbs-1.discover-wp.com

http://ram1-23189-tbs-1.discover-wp.com/wp-admin/admin.php?page=views-editor&view_id=97

#556549

Noman
Forum moderator

Supporter languages: English (English )

Supporter Timezone: Asia/Karachi (GMT+05:00)

Hello Ram,

I have tried few things in your site. Can you please confirm and explain why you are using many-to-many relationship for this?

As I see in real world the example and hierarchy is like this:

Country
  >> has Colleges
    >> has Consultants

-- In this case a Consultant can only belongs to one College, where as college is already linked to a Country. As such we don't need Country custom field for the Consultant itself.

Is the above scenario not same as your case? If your case is different please explain your hierarchy as well. Thanks

#556711

Hi

In my case : One consultant can have more than one colleges they belong to and One College can have more than one consultants

>> Colleges -- Country - Custom Fields
>> Common

>> Consultants -- Country - Custom Fields
>> Common

#557187

Noman
Forum moderator

Supporter languages: English (English )

Supporter Timezone: Asia/Karachi (GMT+05:00)

Hello Ram,

Sorry we ran into the weekend. Thank you for providing more details. I am again checking this now, looks like we have found some limitation or bug for many-to-many relationship Custom search. I will update you shortly with my findings.

Thank you for your co-operation.

#557328

Noman
Forum moderator

Supporter languages: English (English )

Supporter Timezone: Asia/Karachi (GMT+05:00)

I am able to reproduce this issue. I have escalated this issue to our 2nd tier support for further review and we will get back to you with an update.

Thank you for your co-operation and patience.

#557848

Noman
Forum moderator

Supporter languages: English (English )

Supporter Timezone: Asia/Karachi (GMT+05:00)

Our 2nd tier support informed that this type of Custom Field search filter is not possible with Toolset for many-to-many relational posts. I have now submitted this as a feature request to our team for further consideration.

Thank you for cooperation. Have a wonderful day.

#558833

Thanks very much Noman.

#558872

Noman
Forum moderator

Supporter languages: English (English )

Supporter Timezone: Asia/Karachi (GMT+05:00)

Please kindly mark this current ticket as resolved if all is good now.

You can subscribe to our blog for news and feature updates: http://wp-types.com/blog

Thank you

Viewing 12 posts - 1 through 12 (of 12 total)

The topic ‘[Closed] Many to Many Relationship display brother fields in another post’ is closed to new replies.