[Resolved] Nested conditionals in content template
This support ticket is created 6 years, 3 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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
I have a site on a multisite installation that is using a content template for a custom post type "Advertisements." The content template has conditionals for each of the seven different categories in the "Advertisements Types" taxonomy. The content template works fine except for two categories conditionals that also have another conditional inside of them. For only posts in the "solicitation-from-prequalified-contractor" and "public-meeting-notices" categories, the custom field shortcodes will not display their data, just the [types field="__"][/types] shortcode itself. I'm not sure if the nested conditionals are problem exactly, but the issue only occurs when there is nested conditionals.
Relevant code from the content template (the other category code is similar, just without nested conditionals):
Unfortunately I cannot give you admin access as this is a restricted login system from a university. Is there anything I can post to help you troubleshoot?
Hi, Shane is on public holiday so I'll try to help. I've seen issues like this in certain versions of PHP, where our regex algorithms break down with medium to large blocks of content and conditionals, resulting in shortcodes written out to the page. As a quick test, can you turn off pcre.jit by adding this line to your php.ini file?
pcre.jit= 0
If you're not able to modify php.ini, you can try adding this line to your wp-config.php file:
ini_set('pcre.jit', false);
Give that a quick run and see if it makes any difference. If not, I'll be glad to take a closer look.
Actually, looks like we've solved the issue. We're not quite sure how exactly since we tried multiple options to fix the issue, but it may have been a plugin conflict or some errant code.