Skip Navigation

[Resolved] Make wpv-conditional statement with ‘page id’ check

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

Problem:

I need to conditionally show the following statement, for logged in non-logged users in all post/pages/product but with ID = '1342', but it not working.

Solution:

You can try below shortcodes:

https://toolset.com/forums/topic/make-wpv-conditional-statement-with-page-id-check/#post-1586371

Relevant Documentation:

https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/#connecting-conditions

This support ticket is created 2 years, 9 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
- 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 replies, has 2 voices.

Last updated by dmitryK-2 2 years, 9 months ago.

Assigned support staff: Luo Yang.

Author
Posts
#1586323

Tell us what you are trying to do?

I need to conditionally show the following statement, for logged in non-logged users in all post/pages/product but with ID = '1342', but it not working, problem with getting & checking the 'page_id' :

[wpv-conditional if="( '[wpv-current-user info='logged_in']' eq 'false' ) and ( ' [wpv-post-id] ' ne ' 1342 ' )"]

<div id="sht-subscribe-us">[cred_user_form form="sht-mail-signup"]</div>

[/wpv-conditional]

[wpv-conditional if="( '[wpv-current-user info='logged_in']' eq 'true' )"] Opening soon![/wpv-conditional]

What is the link to your site?
tao-online.net ... any page

#1586371

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

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

Hello,

There are two issues in your codes:
1) There are some extra space.
2) You will need to use uppercase "AND".

Please try to modify your codes as below:

[wpv-conditional if="( '[wpv-current-user info='logged_in']' eq 'false' ) AND ( '[wpv-post-id]' ne '1342' )"]
<div id="sht-subscribe-us">[cred_user_form form="sht-mail-signup"]</div>
[/wpv-conditional]
 
[wpv-conditional if="( '[wpv-current-user info='logged_in']' eq 'true' )"] Opening soon![/wpv-conditional]

And test again.

More help:
https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/#connecting-conditions
See screenshot:
https://toolset.com/wp-content/uploads/2019/02/view-connecting-conditions.png

#1586379

My issue is resolved now. Thank you!