Answer the question
In order to leave comments, you need to log in
How to put a condition in an array?
Hello dear!
I'm making a multilingual website using wpml. There is a function wp_json_send_error in which you need to apply a condition.
Here is the condition
<?php if(ICL_LANGUAGE_CODE=='en'): ?>Email error<?php elseif(ICL_LANGUAGE_CODE=='it'): ?>Email error<?php elseif(ICL_LANGUAGE_CODE=='ru'): ?>Неправильный email<?php endif; ?>
wp_send_json_error(array('message' => 'Неправильный email', 'redirect' => false));
Answer the question
In order to leave comments, you need to log in
Throw away this noodle*.
Start reading from here https://codex.wordpress.org/I18n_for_WordPress_Dev...
The result will be something like this:
$err_msg = __('Email error', LANGUAGE_CODE);
wp_send_json_error(array('message' => $err_msg, 'redirect' => false));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question