How to configure WPML for the Search Form

The search form sends the result to a single page that is set into the theme options panel. If you wish to send the search results to another page in another language you’ll have to translate the search results page and then modify the search form code to send the form to this other page.

To modify the search form code open file search.php and advanced-search.php in folder /framework/extensions/ and locate this line

Replace it with this

You need to replace where you see “URL OF THE SPANISH PAGE” with the URL of your translated search results page. for example set it to “http://example.com/es/search-results”. Remember it must be your url. If you have more than 2 languages, you can extend the if statement like this.

ICL_LANGUAGE_CODE refers to your languages codes, so for example for spanish, you will set it to “es”, for italian, you can set it to “it” and so on. It is obvious that your vehicles, together with colors, makers, models etc need to be translated too. If the vehicles are not translate, it will obviously not find any vehicle. Once you’ve made the modification, make sure you save the file.