in a form I do not know how to make a taxonmy field required ?
[cred_field field='type-de-projet' placeholder="Type de projets" force_type='taxonomy' display='checkbox' single_select='true']
Hi Nigel,
how can we translate the error message in this case (with wpml) ?
Thanks
Olivier
Nigel
Supporter
Languages:
English (English )
Spanish (Español )
Timezone:
Europe/London (GMT+00:00)
You need to provide the error texts in gettext calls, so that the string becomes available for translation in WPML.
So where you set an error message you would do so something like:
$errors['wpcf-my_field'] = __('Wrong Value', 'text-domain');
Whatever you specify for the text-domain can be used to locate the string in WPML.
ok Nigel,
thanks a lot for your answer. I will try this.
I have another question about wpml translation.
I have this code in function.php with a conditonnal redirection after submit a form :
add_filter('cred_success_redirect', 'custom_redirect',10,3);
function custom_redirect($url, $post_id, $form_data)
{
if ($form_data['id']==168 || $form_data['id']==79){
if(isset($_REQUEST['wpcf-association-momentanee'])&& $_REQUEST['wpcf-collaborteur'] == 'Oui' && $_REQUEST['wpcf-association-momentanee'] == 'Oui'){
$url = '/association-collaborateur';
}
if(isset($_REQUEST['wpcf-association-momentanee']) && $_REQUEST['wpcf-association-momentanee'] == 'Oui' && $_REQUEST['wpcf-collaborteur'] == 'Non'){
$url = '/association';
}
if(isset($_REQUEST['wpcf-collaborteur']) && $_REQUEST['wpcf-collaborteur'] == 'Oui' && $_REQUEST['wpcf-association-momentanee'] == 'Non'){
$url = '/collaborateur';
}
}
return $url;
}
I have to change the url according to the language of the user :
Nigel
Supporter
Languages:
English (English )
Spanish (Español )
Timezone:
Europe/London (GMT+00:00)
I'm not quite sure I understand the issue.
The problem is with the tests for the values of the custom fields (e.g. wpcf-collaborteur could be "Oui" in French but could be "Yes" on English translations of the post)?
Or with what the URL should be that you are redirecting to?