Skip Navigation

[Resolved] How can I display relationship fields in a view?

This support ticket is created 4 years, 2 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 2 replies, has 2 voices.

Last updated by nathanB-3 4 years, 2 months ago.

Assisted by: Raja Mohammed.

Author
Posts
#1840239

I have two types: platform and best-platforms

For example: a platform is "Fiverr" and best-platform is "best platforms to make money with logo design".

The two types are connected with a many-to-many relationship. In this relationship, there is a URL for the signup page. I use a view in best-platforms to display every platform connected to it. How can I check if the URL of the relationship is empty (while in the view)?

#1841351

Raja Mohammed
Supporter

Languages: English (English )

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

Hello there

Once you have Post relationship setup you will be able to see all the related field when you click on Fields and Views button in the views loop editor, There you can select the appropriate custom fields and In the insertion dialog, click on the Post selection tab and select to display data for A post related to the current post, set by a Types post reference field.

https://toolset.com/documentation/legacy-features/views-plugin/using-post-reference-fields-to-display-information-from-a-related-post/#displaying-fields-that-belong-to-the-related-post

You can use the inserted shorcode with wpv-conditional output,
for eg: if the shorcode for the related field is
[types field='register-url' item='@post-page.parent'][/types]

Then the conditional to check if it is empty will be

[wpv-conditional if="( '[types field='register-url' item='@post-page.parent'][/types]' eq '' )"]  Display some thin here [/wpv-conditional]

To validate the field is not empty in the conditional statement change eq to ne

Please refer
https://toolset.com/documentation/legacy-features/views-plugin/checking-fields-and-other-elements-for-emptynon-empty-values/#checking-types-checkboxes-field-for-non-empty-value

I hope this helps better

Regards
Raja

#1841539

That's perfect,

I thought that I was supposed to use the if function from toolset, but this code does the trick.

Best, Nathan