-
AuthorPosts
-
March 23, 2014 at 12:22 pm #241790
Hey,
In functions-enfold.php, line 193:
$output .= "<a class='ajax_search_entry ajax_search_entry_view_all' href='".home_url('?' . $search_messages['all_results_link'] )."'>".$search_messages['view_all_results']."</a>";
Should be:
$output .= "<a class='ajax_search_entry ajax_search_entry_view_all' href='".icl_get_home_url('?' . $search_messages['all_results_link'] )."'>".$search_messages['view_all_results']."</a>";
The current behavior is that if I’m in a page that doesn’t belong to the default language, and I open the ajax search box and type some search string, clicking the “View all results” at the bottom of the ajax search box sends me to a search results link in the default language, and not in the current language. I should state also that we use permalinks for indicating the language.
Anyway, I tried to add a filter, but it caused an infinite loop (don’t know why, I don’t think icl_get_home_url uses the get_home_url function in any way):
add_filter( 'home_url', 'localized_home_url', 10, 4); function localized_home_url( $url, $path, $orig_scheme, $blog_id ) { if($path === ''){ return icl_get_home_url(); } return $url; }
Suggestions?
Thanks,
LiorMarch 23, 2014 at 2:04 pm #241796Found a solution:
add_filter( 'home_url', 'localized_home_url', 10, 4); function localized_home_url( $url, $path, $orig_scheme, $blog_id ) { if(strpos($path, '?') === 0){ return icl_get_home_url().$path; } return $url; }
March 23, 2014 at 8:26 pm #241851Hey!
Glad you found a solution. I recommend to paste the code into the child theme functions.php – then the theme update won’t overwrite it.
Cheers!
PeterAugust 18, 2014 at 3:04 pm #305767Hi Dude,
I’ve got the same problem. Pasting the code at the end of my functions.php doesn’t bring the solution.
Do you have an idea how to get the search results in the correct language?
Thanks, BerndAugust 18, 2014 at 3:11 pm #305774Hi!
Please create us an admin account and post the login credentials as private reply – I’ll look into it.
Regards,
PeterAugust 19, 2014 at 12:07 pm #306234This reply has been marked as private.August 20, 2014 at 11:25 am #306742Hi!
We’ll fix this with the next update. For a temporary fix open up enfold/enfold-functions.php and replace:
$output .= "<a class='ajax_search_entry ajax_search_entry_view_all' href='".home_url('?' . $search_messages['all_results_link'] )."'>".$search_messages['view_all_results']."</a>";
with
$output .= "<a class='ajax_search_entry ajax_search_entry_view_all' href='".icl_get_home_url(). '?' . $search_messages['all_results_link'] ."'>".$search_messages['view_all_results']."</a>";
Best regards,
PeterAugust 20, 2014 at 12:11 pm #306773Hi Peter,
sorry, but the code produces a syntax error message.
I think, there is something wrong with “(” or “)”.
Would you please try again?
Thanks, BerndAugust 20, 2014 at 1:42 pm #306826Hey!
Yes – I forgot to delete a ) charachter. I corrected the code – please try it again.
Cheers!
PeterAugust 20, 2014 at 2:02 pm #306837Hi Peter, everything works fine. Thanks a lot, Bernd
August 21, 2014 at 8:19 am #307211Hi!
Great. I already send a patch to Kriesi and we’ll release it with ther next update.
Cheers!
Peter -
AuthorPosts
- The topic ‘Search results link not WPML compattible’ is closed to new replies.