Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #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,
    Lior

    #241796

    Found 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;
    }
    #241851

    Hey!

    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!
    Peter

    #305767

    Hi 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, Bernd

    #305774

    Hi!

    Please create us an admin account and post the login credentials as private reply – I’ll look into it.

    Regards,
    Peter

    #306234
    This reply has been marked as private.
    #306742

    Hi!

    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,
    Peter

    #306773

    Hi Peter,
    sorry, but the code produces a syntax error message.
    I think, there is something wrong with “(” or “)”.
    Would you please try again?
    Thanks, Bernd

    #306826

    Hey!

    Yes – I forgot to delete a ) charachter. I corrected the code – please try it again.

    Cheers!
    Peter

    #306837

    Hi Peter, everything works fine. Thanks a lot, Bernd

    #307211

    Hi!

    Great. I already send a patch to Kriesi and we’ll release it with ther next update.

    Cheers!
    Peter

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Search results link not WPML compattible’ is closed to new replies.