Sauter la navigation

[Résolu] Using Relationships in Conditions in a Conditional Group in a Form

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem: I would like to use conditional groups in Forms to test the selected parent post.

Solution: You can use the following syntax to test the selected parent:

[cred_show_group if="( $(@relationship-slug.parent) eq '12345' )" mode="fade-slide"]
Show this content when the parent has ID 12345
[/cred_show_group]

Replace relationship-slug with the slug of the relationship, and replace 12345 with the ID to test.

0% of people find this useful.

This support ticket is created Il y a 5 années et 8 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

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

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

Assisté par: Christian Cox.

Auteur
Publications
#1235642

I want to display a Conditional Group in a form, depending on a relationship value selected in the form.

But I can't see the Relationship appearing in the drop-down for selecting the condition(s).

Does that mean this is not possible?

#1235692

Hi, it's possible to target that field in the Form editor's Expert mode. If you're creating child posts in the Form and selecting parent posts, you can use this shortcode as a template:

[cred_show_group if="( $(@relationship-slug.parent) eq '12345' )" mode="fade-slide"]
Show this content when the parent has ID 12345
[/cred_show_group]

Replace 12345 with the numeric ID of the parent you want to target, and replace relationship-slug with the slug of the relationship.

#1236084

That works perfectly.

Thanks, Christian.

Alex