Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-sales domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the better-click-to-tweet domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-amazon domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-stats domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114
Conditional statement based on [answer] shortcode | Event Espresso - Staging Server

Support

Home Forums Event Espresso Premium Conditional statement based on [answer] shortcode

Conditional statement based on [answer] shortcode

Posted: March 5, 2014 at 4:29 pm

Viewing 1 reply thread


Sylvain Asselin

March 5, 2014 at 4:29 pm

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.

If I just do :

<code>$answer=&#039;[answer_question1]&#039;;
echo $answer;</code>

it works fine.

If I try

<code>if ($answer = &#039;the complete answer&#039;) {
// do something
}</code>

it does not work.

Can you tell me what would work?


Dean

  • Support Staff

March 6, 2014 at 2:44 am

Hi,

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.

We also have a list of recommended developers should you require further coding assistance – http://staging.eventespresso.com/developers/event-espresso-pros/

Viewing 1 reply thread

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.

Event Espresso - Staging Server