Conditionals not working as expected

Hi there! It was my understanding that conditionals can work with shortcodes.

I have shortcodes that render either the numerical 1 or 0. i am trying to use conditionals inside a looper.

So i am trying to get the elements inside the looper to either show or not show using
image
or
image

I can confirm that the shortcode is working as expected because i have placed it inside the elements themselves in text and i see it render either 0 or 1 exactly where expected. But when applied to the conditional (inside the looper) it does not work.

Interestingly, when i try to ‘hack’ visibility via css by applying a class visibility-[myshortcode] it always renders visibility-0, despite the shortcode in the text showing a 1. So this suggests shortcodes aren’t processed correctly inside a conditional if inside a looper? How can i fix this?

Hello @TristanP,

Thanks for writing in! Could you change the role of the given user account to an Administrator so that we can check the page and the code of the shortcode as well?

Thanks.

Hi @ruenel I have updated the secure note with a login ID that has Administrator privileges.

Hi @ruenel

I found out what the problem is.

It seems it is working exactly as expected on the front end for normal users.

I was testing with a user ID that had admin privileges it wasn’t working for admins (despite the fact that I had not set the preview to ignore conditions, it wasn’t working for admins inside the looper so maybe that is a bug ? )

But as far as i can tell it does work for logged in users that are NOT admins. Which is what i needed

Hey Tristan,

It is good to know that you have figured out the problem and have now resolved it.
We really appreciate you letting us know about it.

Cheers.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.