Skip Navigation

[Résolu] wp-if test on a parent fields

This support ticket is created Il y a 7 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/Hong_Kong (GMT+08:00)

Marqué : 

This topic contains 2 réponses, has 2 voix.

Last updated by tony Il y a 7 années et 9 mois.

Assigned support staff: Luo Yang.

Auteur
Publications
#291786

I am not sure if what I want to do is possible or if I just have wrong syntax.

I use the following test to check an end date being different to a start date and it works fine.

[wpv-if f1="wpcf-event-end-date" f2="wpcf-event-start-date" evaluate="$f1 > $f2" debug="true"] - [types field="event-end-date" style="text" format="F j l"][/types][/wpv-if]

I want to use a similar test but the date fields are in a parent post called event. I tried a few syntax combinations but cannot get anything to work. Here is my latest attempt:

[wpv-if f1="wpcf-event-end-date id='$event'" f2="wpcf-event-start-date id='$event'" evaluate="$f1 > $f2" debug="true"] - [types field="event-end-date" id="$event" style="text" format="F j l"][/types][/wpv-if]

Please can you assist?

Thanks
Tony

#291898

Luo Yang
Supporter

Languages: Anglais (English ) Chinois simplifié (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Please try this:

[wpv-if evaluate="'[wpv-post-field name="wpcf-event-end-date" id="$event"]' > '[wpv-post-field name="wpcf-event-start-date" id="$event"]'" debug="true"]
 - [types field="event-end-date" style="text" format="F j l"][/types]
[/wpv-if]

More help:
https://toolset.com/documentation/views-shortcodes/#wpv-post-field

#296898

Thanks Luoy - sorry about delayed response - I was diverted to another project!
Tony