Skip Navigation

[Resolved] Conditional If not working

This support ticket is created 6 years 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 Christian Cox 6 years ago.

Assisted by: Christian Cox.

Author
Posts
#1186042

I am trying to:<p>{!{wpv-conditional if="( $(rcp_subscription_level) eq 'home' )"}!}hello{!{/wpv-conditional}!}</p>

Link to a page where the issue can be seen:

I expected to see: the work hello appear

Instead, I got:nothing

#1186079

I have also been trying to use the debug feature and that doesn't work. I need help asap

#1186095

Hello, can you try this code instead?

before hello<br />
{!{wpv-conditional if="( $(rcp_subscription_level) eq 'home' )" debug="true"}!}
  hello<br />
{!{/wpv-conditional}!}
after hello<br />
{!{wpv-conditional if="( '1' eq '1' )" debug="true"}!}
  1=1<br />
{!{/wpv-conditional}!}
after 1=1 test<br />

Then include the results in your next reply. Also please let me know what type of field is rcp_subscription_level, and if you created this field in Types or if it's a 3rd-party custom field.

#1186098

Here is the response.

rcp_subscription_level is a 3rd party custom field

before hello

####################
wpv-conditional attributes
####################
Array
(
[if] => ( $(rcp_subscription_level) = 'home' )
[debug] => true
)

####################
Debug information
####################
--------------------
Original expression: ( $(rcp_subscription_level) = 'home' )
--------------------
--------------------
Converted expression: ( 'any-paid' = 'home' )
--------------------
after hello

1=1

####################
wpv-conditional attributes
####################
Array
(
[if] => ( '1' = '1' )
[debug] => true
)

####################
Debug information
####################
--------------------
Original expression: ( '1' = '1' )
--------------------
After replacing 1 general variables and comparing strings: ( 1 = 1 )
Comparing 1 to 1
after 1=1 test

#1186110

Okay the debug information for the first conditional shows this:

Converted expression: ( 'any-paid' = 'home' )

This says the rcp_subscription_level field for the current post has a value of "any-paid", not "home", so the text "hello" is not shown. Where have you placed this conditional code? If it's in a Content Template, where is this Content Template displayed? If it's in a View, where is this View displayed?