-
-
Save InoPlugs/f6e551f9aaf5ff33a9c6 to your computer and use it in GitHub Desktop.
ajax search wpml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('avf_ajax_search_messages', 'avia_translate_search_text', 10, 2); | |
function avia_translate_search_text($search_messages, $search_query) | |
{ | |
if(defined('ICL_SITEPRESS_VERSION') && defined('ICL_LANGUAGE_CODE')) | |
{ | |
switch(ICL_LANGUAGE_CODE) | |
{ | |
case 'en': | |
$search_messages['no_criteria_matched'] = "Sorry, no posts matched your criteria"; | |
$search_messages['another_search_term'] = "Please try another search term"; | |
$search_messages['time_format'] = get_the_time(get_option('date_format')); | |
$search_messages['view_all_results'] = 'View all results'; | |
break; | |
case 'es': | |
$search_messages['no_criteria_matched'] = "Sorry, no posts matched your criteria"; | |
$search_messages['another_search_term'] = "Please try another search term"; | |
$search_messages['time_format'] = get_the_time(get_option('date_format')); | |
$search_messages['view_all_results'] = 'View all results'; | |
break; | |
case 'fr': | |
$search_messages['no_criteria_matched'] = "Sorry, no posts matched your criteria"; | |
$search_messages['another_search_term'] = "Please try another search term"; | |
$search_messages['time_format'] = get_the_time(get_option('date_format')); | |
$search_messages['view_all_results'] = 'View all results'; | |
break; | |
case 'ru': | |
$search_messages['no_criteria_matched'] = "Sorry, no posts matched your criteria"; | |
$search_messages['another_search_term'] = "Please try another search term"; | |
$search_messages['time_format'] = get_the_time(get_option('date_format')); | |
$search_messages['view_all_results'] = 'View all results'; | |
break; | |
case 'da': | |
$search_messages['no_criteria_matched'] = "Sorry, no posts matched your criteria"; | |
$search_messages['another_search_term'] = "Please try another search term"; | |
$search_messages['time_format'] = get_the_time(get_option('date_format')); | |
$search_messages['view_all_results'] = 'View all results'; | |
break; | |
case 'sv': | |
$search_messages['no_criteria_matched'] = "Sorry, no posts matched your criteria"; | |
$search_messages['another_search_term'] = "Please try another search term"; | |
$search_messages['time_format'] = get_the_time(get_option('date_format')); | |
$search_messages['view_all_results'] = 'View all results'; | |
break; | |
} | |
} | |
return $search_messages; | |
} | |
add_filter('avf_ajax_search_label_names', 'avia_translate_post_types_search', 10, 1); | |
function avia_translate_post_types_search($label) | |
{ | |
if(defined('ICL_SITEPRESS_VERSION') && defined('ICL_LANGUAGE_CODE')) | |
{ | |
if($label == 'Beiträge') | |
{ | |
switch(ICL_LANGUAGE_CODE) | |
{ | |
case 'en': | |
$label = "Posts"; | |
break; | |
case 'es': | |
$label = "Posts"; | |
break; | |
case 'fr': | |
$label = "Posts"; | |
break; | |
case 'ru': | |
$label = "Posts"; | |
break; | |
case 'da': | |
$label = "Posts"; | |
break; | |
case 'sv': | |
$label = "Posts"; | |
break; | |
} | |
} | |
else if($label == 'Seiten') | |
{ | |
switch(ICL_LANGUAGE_CODE) | |
{ | |
case 'en': | |
$label = "Pages"; | |
break; | |
case 'es': | |
$label = "Posts"; | |
break; | |
case 'fr': | |
$label = "Posts"; | |
break; | |
case 'ru': | |
$label = "Posts"; | |
break; | |
case 'da': | |
$label = "Posts"; | |
break; | |
case 'sv': | |
$label = "Posts"; | |
break; | |
} | |
} | |
else if($label == 'Portfolio Einträge') | |
{ | |
switch(ICL_LANGUAGE_CODE) | |
{ | |
case 'en': | |
$label = "Portfolio Entries"; | |
break; | |
case 'es': | |
$label = "Posts"; | |
break; | |
case 'fr': | |
$label = "Posts"; | |
break; | |
case 'ru': | |
$label = "Posts"; | |
break; | |
case 'da': | |
$label = "Posts"; | |
break; | |
case 'sv': | |
$label = "Posts"; | |
break; | |
} | |
} | |
} | |
return $label; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment