Skip Navigation

[Resolved] Conditional Logic is not working as I expected. An example is below.

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

Problem:
Conditional Logic is not working as I expected. An example is below.

Solution:
User confirms that the problem appears to be caused by a conflict with either Autoptimize or Async JavaScript plugins. I disabled them for another reason and noticed that the conditional logic worked correctly.

Relevant Documentation:

This support ticket is created 6 years, 2 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 2 replies, has 2 voices.

Last updated by Jonathon Hanten 6 years, 2 months ago.

Assisted by: Minesh.

Author
Posts
#1135515

I am trying to: Have a slider that has images with links when a link field has a url and no links when it does not. The code in the template I have tried is as follows:

<li>[wpv-conditional if="( $(wpcf-slider-forwarding-url) ne '' )"]
   <a href="[types field='slider-forwarding-url' output='raw'][/types]"><img src="[types field="slide-image" url="true" width="995" height="419"][/types]" alt="[wpv-post-title]"></a>[/wpv-conditional][wpv-conditional if="( $(wpcf-slider-forwarding-url) eq '' )"]<img src="[types field="slide-image" url="true" width="995" height="419"][/types]" alt="[wpv-post-title]">[/wpv-conditional]
  </li>

Link to a page where the issue can be seen: Currently this is not setup on own website because of this issue.

I expected to see: I expected to see one image that is either functioning as a link or is not.

Instead, I got: The slider showed two images with the first being a link and the second without. It basically ignored the conditional logic completely.

What did I do wrong? I would be happy to give access to a staging site, but I don't have one setup. I can on Monday if that is helpful.

Thank you.

#1135896

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - could you please share problem URL and access details where I can see the issue?

I have set the next reply to private which means only you and I have access to it.

#1136570

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - could you please share problem URL where you added the conditional shortcode?