Reply To: WPML translation and search



Hey, this code totally crashes my site with the following error:
Parse error: syntax error, unexpected '$lang_arg' (T_VARIABLE) in /home/mysite/public_html/wp-content/themes/StyleShop/functions.php on line 960

Had to go into the ftp to change the functions.php back to the original to get it back. It might work based on what I see but somewhere there is a parsing error.

This is the difference to the add to cart url:

The default language uses this:

The translated language uses this:

So if the search would use that translated style add to cart url when on the default language it would work (I only got two languages)

I mean, pressing other “add to cart” buttons on the translated pages work fine, it redirects to the localized version of the cart page. However I think the code in functions.php as it is does not get automatically adjusted. So again, I think your code has potential, maybe it has a small error somewhere that crashes it at the moment. But the idea of checking what language we are in and then changing the url should work fine… all that needs to happen is for it to add the “&lang=nl” part to the url when we are on the translated pages and not add it on the site default language.