Skip Navigation

[Resolved] conditional output based on relationship parent title

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

Problem:

The issue here is that the user wanted to display an output based on the parent title.

Solution:

This can be done with following code.

[wpv-conditional if="( '[wpv-post-title item='@program-event.parent']' ne '' )"]

Content here

[/wpv-conditional]
This support ticket is created 6 years, 4 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 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 4 replies, has 2 voices.

Last updated by joseM-8 6 years, 4 months ago.

Assisted by: Shane.

Author
Posts
#1112768

So i have set up "events" with a many to one "program" relationship

in the event archive i want to display the "program" post title - i got this to work with
[wpv-post-title item="@program-event.parent"]

but not all events are connected to a program so i want to conditional output the "program" post title on it if it is not empty

i have tried a mix of things but i can't get it to work.

#1113067

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jose,

Thank you for contacting our support forum.

So you want to output the Parent title if the child event has a program correct?

Please let me know.

Thanks,
Shane

#1113069

That is correct

#1113179

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jose,

So if you add this to a post and the post doesn't have a parent the shortcode returns empty ?

Then you should be able to do this.

[wpv-conditional if="( '[wpv-post-title item='@program-event.parent']' ne '' )"]

Content here

[/wpv-conditional]

Please try this and let me know if it helps.

Thanks,
Shane

#1113189

My issue is resolved now. Thank you!