Skip Navigation

[Resolved] ShortCodes inside HTML conditionals not rendered

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

Problem:
When showing ShortCodes conditionally with a HTML conditional, those ShortCodes are not rendered in the front end.

Solution:
If you are sure the HTML conditional is well-formatted and the condition matching your content, then it could be due to character limitation as explained here:

https://toolset.com/errata/shortcodes-in-conditionally-displayed-content-may-not-be-executed-on-the-front-end/

This support ticket is created 4 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 2 replies, has 2 voices.

Last updated by umbertoZ 4 years ago.

Assisted by: Beda.

Author
Posts
#1582001

Hi, I've added this code inside a Content template assigned to a CPT:

<h1>[wpv-post-title]</h1>

<div> 
   [types field='field1'][/types]<br>
   [types field='field2'][/types]<br>
</div>

[wpv-conditional if="( '[wpv-current-user info='logged_in']' eq 'false' )"]

[wpv-login-form redirect_url="[wpv-post-url]" allow_remember="true" remember_default="true"]

[/wpv-conditional]

[wpv-conditional if="( '[wpv-current-user info='role']' eq 'administrator' )"]

<div> 
   [types field='field3'][/types]<br>
   [types field='field4'][/types]<br>
</div>

[/wpv-conditional]

When I display a post on the frontend the shortcodes insided wpv-conditional are not rendered (the other are rendered correctly).

If I move the same code to a Page content it works fine.

I'm working with Astra Theme, but I've the same problem with the default theme. I've also deactivated all the plugins and I din't find any conflict.

Can you help me?

#1582077

This works great on my local test, It must be either a conflict or a custom code issue or a server issue, because I used the exact same code on my local and it worked great.

I am certain you can confirm this as well in any other Site running Toolset?

It should be some specific issue, maybe a too great content allover displaying?
See https://toolset.com/errata/shortcodes-in-conditionally-displayed-content-may-not-be-executed-on-the-front-end/

If this does not help I'll need a copy of named site if possible to deploy locally.

#1582383

My issue is resolved now.

I didn't know about the characters limitation, it was the problem.

Thank you Beda!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.