This topic has 2 replies, 2 voices, and was last updated 8 years, 3 months ago ago by Robert Hall
I might be asking a WP question here, but in the theme’s header.php there is a section for the languages.
I have WPML structuring the different languages in directory format, and no longer in ?lang= format.
When I used the top bar to switch languages with the ?lang format, it change the language, and stayed on the same page, which is what I wanted.
I do not know how to achieve the same with the /en/ format of url’s. How do I switch language while staying on the same page ?
<ul class=”links”>
<ul>
<li><a href=”/fr/#”>FR>/a<>/li>
<li><a href=”/nl/#”>NL</a></li>
</ul>
brings the right language, but always the home-page
Hello,
Try to use the following code
<ul class=”links”>
<li><a href="<?php echo '/fr' . $_SERVER["REQUEST_URI"] ?>">FR</a></li>
<li><a href="<?php echo '/nl' . $_SERVER["REQUEST_URI"] ?>">NL</a></li>
</ul>
Regards,
Robert Hall
Tagged: header.php, language, multi language, switching, template, woocommerce, wordpress
You must be logged in to reply to this topic.Log in/Sign up