Skip Navigation

[Resolved] Complex Conditional HTML

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

Problem: I would like to create conditional HTML that tests (A OR B) AND C.

Solution: Use the conditional syntax:

[wpv-conditional if="(( '[wpv-current-user info='role']' eq 'candidat_v1' ) OR ( '[wpv-current-user info='role']' eq 'candidat_v2' )) AND ( cv_post_count() lt '1' )"]
your content here
[/wpv-conditional]

Relevant Documentation:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/

This support ticket is created 6 years, 7 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
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)

This topic contains 4 replies, has 2 voices.

Last updated by ericW-5 6 years, 7 months ago.

Assisted by: Christian Cox.

Author
Posts
#734399

Hi

I am currently showing some fields if user role is "candidate_v1" AND post_count is lower than 1 as follows:
[wpv-conditional if="( '[wpv-current-user info='role']' eq 'candidat_v1' ) AND ( cv_post_count() lt '1' )"] ...

In fact I would need to display these fields in 2 situations : if role = "candidate v1" OR if role is "candidate v2"

How should I write this ?

#734777

How about this:

[wpv-conditional if="( '[wpv-current-user info='role']' eq 'candidat_v1' ) OR ( '[wpv-current-user info='role']' eq 'candidat_v2' )"] 
#734833

Hi thanks a lot

Sorry for misunderstanding, in fact i woud like to get (candiat_v1 OR candidat_v2) AND (cv_post_count lower than 1)

Is the following syntax correct ?
[wpv-conditional if="(( '[wpv-current-user info='role']' eq 'candidat_v1' ) OR ( '[wpv-current-user info='role']' eq 'candidat_v2' )) AND ( cv_post_count() lt '1' )"]

Regards
Eric

#736360

Looks good to me, does it work as expected?

#736361

all solved
thanks