Skip Navigation

[Résolu] Evaluate status in a parent – syntax please

This support ticket is created Il y a 9 années et 1 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)

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

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

Assigned support staff: Luo Yang.

Auteur
Publications
#182027

I have a parent post type event-type that contains a status field
[types field="event-type-boat-requests-allowed-status" output="raw" id="$event-type"][/types]

I know that displaying this field produces the correct value.

I want to test for a status value = 1 but cannot seem to get the syntax right.

My attempt is:

[wpv-if status="wpcf-event-type-boat-requests-allowed-status" id="$event-type" evaluate="$status=1"] ...... [/wpv-if]

I use this type of condition test quite often (without the parent link)
e.g.
[wpv-if status="wpcf-event-status" evaluate="$status=1"]
and it works fine.

Adding the parent linkage seems to be messing something up somewhere.

Any suggestions much appreciated as I have tried searching for the answer and experimented with lots of syntax combinations. It appears that my syntax thinks the status in the data record is 0 instead of 1.

Many thanks
Tony

#182251

Luo Yang
Supporter

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

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

Hi Tony,

Please try this:

[wpv-if evaluate="'[types field="event-type-boat-requests-allowed-status" output="raw" id="$event-type"][/types]'=1"]
display something
[/wpv-if]

More help:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/#checking-other-attributes

#182258

Hi Luoy

Excellent - works fine.

I tried the link suggested before but could not find a parent example that fitted what I wanted to do. I now have a template for future use (added to my library!).

Thanks
Tony