Skip Navigation

[Resolved] Filtering a view relationship with custom foelds

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

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

Assisted by: Luo Yang.

Author
Posts
#1204869
view-relationship.png
Screen Shot 2019-02-22 at 5.34.03 PM.jpg
Screen Shot 2019-02-22 at 5.32.55 PM.jpg

I have a post type "Mots" and a post type "Concept". I created a many to many relationship between the 2, with 2 custom fields "Principe Dynamic" and "Portrait". I created a view for this relationship, it works fine until I added a"Custom field filter".
Not sure what I am doing wrong. All screenshots are attached. Not sure what I am doing wrong.

#1205241
Custom-field-content.JPG

Hello,

I assume you are using two custom fields "Principe Dynamic" and "Portrait" in post type "Concept", how do you setup those two custom fields.

Please edit them, make sure you are using the same field value as you setup in Views filter:
hidden link

For example, if it is a custom select field, you can edit it, get the field value in option's "Custom field content", see screenshot
Custom-field-content.JPG

#1205259
Screen Shot 2019-02-24 at 8.49.17 PM.jpg
Screen Shot 2019-02-24 at 8.50.07 PM.jpg
Screen Shot 2019-02-24 at 8.50.47 PM.jpg
custom-fileds-concepts-to-mots.png

I am using the same Custom Fields Content. I have a mot "Test" with 2 Concepts to Mots relationships under "Nous Rappelle" but there is no items found.

#1205277

Please check these:

1) You are using the latest version of Toolset plugins

2) In case it is a compatibility problem, please deactivate other plugins, and switch to wordpress default theme 2019, and test again

3) If the problem still persists, please provide database dump file(ZIP file) of your website, also point out the problem page URL and view URL, I need to test and debug it in my localhost, thanks
https://toolset.com/faq/provide-supporters-copy-site/

#1206018

Thanks for the details, for security reason, I have changed your post to private message, it is not safe to share your website credentials publicly.

Here are what I found, please check the relationship settings:
hidden link

Those custom fields are setup in the intermediate post type "concept-mot", they are not in the post type "concept", so it conducts the problem you mentioned above.

I have done below modification in your website, edit the view "Nous Rappelle Concept A – Aleph – 1 – Principe créatif":
hidden link
- In section "Content Selection", switch to option "Concepts to Mots Intermediary Posts"
- in section "Query Filter", setup the relationship filter to:
Select posts in a Concepts to Mots relationship that are related to the Post where this View is shown.
- in section "Loop Editor", change the content template shortcode to:
[wpv-post-body view_template="loop-item-in-nous-rappelle-concept" item="@concept-mot.parent"]

test it in front-end:
hidden link
It works fine.

The logic is:
In many-to-many relationship, you can setup post view to:
- Query the intermediate post type
- and display related post information

#1209182
image 2.jpg
image 1.jpg

I copied and pasted the view code from the test site to the live site without success.
I am getting the view query results on the "A classer" section, but not the "Nous Rappelle..." view.

I copied this
hidden link
to this
hidden link
with no success.

At this point I am not sure what I am doing wrong. (You have the same credentials for the live site and test site)
Thanks

#1209193

Please point out the problem page URL, where can I see the screenshot you mentioned above:
hidden link

#1209207

The view is
hidden link

The page admin is
hidden link

The page front
hidden link

Thank you.

#1209252

There should be some miss-typo in the field filter, I have done below modification in your website:
Edit the post view "Nous Rappelle Concept A – Aleph – 1 – Principe créatif":
in section "Query Filter", change the custom field filter to:
Select items with field:
Portait is a string equal to A – Aleph – 1 – Principe créatif

Please test again, check if it is fixed, you can get the option value here:
hidden link

#1209804

I am still not sure what I was doing wrong as I just copied and pasted the info. Anyway I duplicated yours and all the views seem to be working. Thanks. I have now to look at how I can show the item post link and all the information from the related post as well as the posts that are related to this related posts.

#1209810

I assume the original question of this thread has been resolved:
https://toolset.com/forums/topic/filtering-a-view-relationship-with-custom-foelds/#post-1204869

Please create new ticket for other new questions, that will help other users to find the answers.