Sauter la navigation

[Résolu] View not showing results with a relationship.

This support ticket is created Il y a 5 années et 10 mois. 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/Karachi (GMT+05:00)

Ce sujet contient 4 réponses, a 2 voix.

Dernière mise à jour par barryG-4 Il y a 5 années et 10 mois.

Assisté par: Waqar.

Auteur
Publications
#1203179
Screenshot 2019-02-20 at 13.29.49.png
Screenshot 2019-02-20 at 13.20.31.png

I am trying to:

I have a main CPT called girls and another CPT type called reviews. I have created a one to many relationship to show one girl with many reviews (screenshot of settings attached).

An elementor theme builder page displays the girls CPT post data. On that page I have added an elementor module for a toolset view.

That view is supposed to show a one to many relationship table for many reviews related to the girl post being viewed. So if Kristen had 8 reviews, then a table on her page would list those reviews only and no-one elses.

So far I’ve failed to get this to show any results. The view settings are:

Content Section: Post types - Reviews
Query Options: Don’t include is ticked.
Query Filter: Select posts in a Girls With Reviews relationship that are a related to the current post in the loop. (relationship settings screenshot attached).

Are you able to help me get this to work please? Apologies for some nudity on the site. The page linked to below does not contain any nudity.

Many thanks,
Barry.

Link to a page where the issue can be seen (towards the bottom of the page under the reviews title: lien caché

I expected to see: a table, in this case, showing one row with one test review.

Instead, I got: No data found

#1203232

Hi Waqar,

In addition to my initial thread above, I've now been able to go into a girl post admin page and manually 'connect' an existing review and that has showed up on the published girl post page correctly as a table row, but I really need this to be an automatic process. Although I know now that what I have done essentially works, can you help to make all reviews automatically appear without needing to be manually connected please. When each review is created a girl is selected from the drop down list in the post relationship field and that association alone is what I thought would show the lost without me having to do anything else.

Many thanks,
Barry.

#1203603

Hi Barry,

Thanks for asking! I'd be happy to help.

When using the Toolset Types plugin, two posts can be connected using any of these methods:

1. Using the new "Post Relationships":
https://toolset.com/documentation/post-relationships/

2. Using a "Post Reference Field":
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/using-post-reference-fields-to-display-information-from-a-related-post/

Note: The Post Reference Field is also a kind of "One-to-Many" relationship, but it was introduced before the full "Post Relationship" feature became available.

On your website, you seem to be using them both for connecting "Girls" and "Reviews", which is not needed and you can choose to keep just one.

If you'll check your view's "Query Filter" section, you'll see the option to filter based on any of these two filters:
Screenshot: lien caché

Based on your personal preference, you can select the "Girl Post Review Girl relationship" option, if you'd like to use the post reference field interface for this connection (2) or you can keep the "Girls With Reviews relationship" option selected if you'd like to keep on using the "Post Relationship" interface (1).

To avoid any future confusion, it would be a good idea to remove the connection which you won't be using.

I hope this helps.

regards,
Waqar

#1203798

Hi Waqar,

Thank you once again for a perfect solution. It took a little while to understand the relationship thing but I've edited the query and it works beautifully thanks to you...

Many thanks,
Barry.

#1203799

My issue is resolved now. Thank you!