I am trying to do a conditional statement in badge-sm.php to display one of three different images based on a choice from a radio button custom field. I tried in many ways but I am not able to do it because it returns the shortcode instead of the shortcode’s result. For example if my shortcode is [answer_question1] I try to get first 3 left characters, it returns [an. Or if I try to count characters it returns 18.
The problem here is that anything like [answer_abc] or [start_date], etc in the ticket is NOT a shortcode, it’s a tag.
The difference is a shortcode will output the results of some code. The tags here are being string replaced.
If you var_dumped the $answer variable you would see that it says something like
string ‘one’ (length=15)
where one is the answer. Notice the length= 15? that’s the length of the tag (yours would be 18 as its a longer question name than mine), versus the actual answer that is 3 characters long.
So the IF statement wont work as the variable doesn’t contain the answer, instead it contains the tag.
I would suggest taking a look at the ticketing addons, functions.php file around line 382 as that’s where it gets the question /answer data.
The support post ‘Conditional statement based on [answer] shortcode’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.