Skip Navigation

[Resolved] Nesting conditional displays of fields

This support ticket is created 4 years, 8 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.

This topic contains 2 replies, has 1 voice.

Last updated by GinaM9227 4 years, 8 months ago.

Author
Posts
#1589611
Screenshot_20200417-121105_Chrome.jpg

Tell us what you are trying to do?

I am trying to nest 2 conditional outputs and need help to check that the code is working correctly.
What I am trying to accomplish is for the _direction_event to show only if the User is Logged In AND the field is not empty. If the field is empty, then nothing would show. If the User is not logged in, then there will be a message asking to log in.

The code below is showing both the address and the non user log in message so not working - see screenshot.

[wpv-conditional if="( '[wpv-current-user info='logged_in']' eq 'false' )"]
Please register and sign-in to view venue details.
[/wpv-conditional]
[wpv-conditional if="( '[wpv-post-field name='_direction_event']' ne '' )"]
[wpv-post-field name='_direction_event']
[/wpv-conditional]
Is there any documentation that you are following?
https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/#syntax

Is there a similar example that we can see? no

What is the link to your site? hidden link

#1589635

Hello, I tried using AND statements and this is the new code - can you please tell me if it works?

[wpv-conditional if="( '[wpv-current-user info='logged_in']' eq 'true' )" AND ( '[wpv-post-field name='_direction_event']' ne '' )] [wpv-post-field name='_direction_event'][/wpv-conditional]

[wpv-conditional if="( '[wpv-current-user info='logged_in']' eq 'false' )" AND
( '[wpv-post-field name='_direction_event']' ne '' )] Please register and sign-in to view venue details.
[/wpv-conditional]

#1589669

My issue is resolved now. Thank you!