Problem:
I am trying to translate text strings inside a Toolset view loop, but it is not detecting the strings.
Solution:
To ensure the strings are detected and translated, you need to wrap the hardcoded strings within the Toolset View with the [wpml-string] shortcode. For example, instead of "Horas," you should write [wpml-string context="my-site"]Horas[/wpml-string]. This will allow you to see the string in WPML > String Translation and proceed with the translation.
I add a snippet to limit the number of words for post content in the form and I get this error:
Cannot redeclare function my_validation.
Solution:
Change the name of the function as you used that somewhere else on your WordPress installation:
add_filter('cred_form_validate','chr_validation',10,2);
function chr_validation($field_data, $form_data)
{
//field data are field values and errors
list($fields,$errors)=$field_data;
//check if post_title field is more than 500 words
if ( str_word_count($fields['post_content']['value']) > 500 )
{
//set error message for post_content field
$errors['post_content']='500 word count exceeded. Please, use less words for your description.';
}
//return result
return array($fields,$errors);
}