Have you finished the setup for the languages in your sites in Settings > General? Seems that you have 2 sites with the same language. Read on here:
https://github.com/lloc/Multisite-Language-Switcher/wiki/Plugin-installation-and-activation#2-choose-the-blog-language
Cheers,
Dennis.
Hi Dennis
thank you for your prompt answer and sorry for my late reply.
I followed your suggestion and now it seems to work but there is another problem.
Into Woocommerce items it works from the English version (primary site)to the italian site (network site) but not from the italian to the english one. In the second case it links to the same italian page instead of the english one.
Do I miss anything?
Thank you
Veronica
Ciao Veronica,
I don’t know how Woocommerce works but I will check if there is a problem during this weekend.
Cheers,
Dennis.
Ok, thank you in advance Dennis for your kind support.
I’ll be waiting for your check. Please write if you need an access to have a quick look to the issue.
Cheers,
Veronica
I tested WooCommerce and there is indeed a problem with the generated URLs. Read on here and let me know if this resolves your problem: https://github.com/lloc/Multisite-Language-Switcher/issues/55
Please Dennis
would you tell me exactly where do I have to put the code you provide?
Hope it works!
Thanks
Just place it in the functions.php of your theme.
Cheers,
Dennis.
It doesn’t work but maybe I am wrong. It works from english to italian but not from the italian site to the english (where “prodotto” should be changed in “product” in the link).
Here the code, is it right?
//woocomerce
remove_action( ‘woocommerce_before_main_content’, ‘woocommerce_output_content_wrapper’, 10);
remove_action( ‘woocommerce_after_main_content’, ‘woocommerce_output_content_wrapper_end’, 10);
add_action(‘woocommerce_before_main_content’, ‘my_theme_wrapper_start’, 10);
add_action(‘woocommerce_after_main_content’, ‘my_theme_wrapper_end’, 10);
function my_theme_wrapper_start() {
echo ‘<section id=”main”>’;
}
function my_theme_wrapper_end() {
echo ‘</section>’;
}
add_theme_support( ‘woocommerce’ );
function my_msls_options_get_permalink( $url, $language ) {
if ( ‘en_US’ == $language ) {
$url = str_replace( ‘/prodotto/’, ‘/product/’, $url );
}
return $url;
}
add_filter( ‘msls_options_get_permalink’, ‘my_msls_options_get_permalink’, 10, 2 );
?>
Sorry but I am not a developer 😛 The website is finished and I only miss this to publish it for my client.
Thanks!
I guess – because the URL contains already the word ‘product’ – you need just to modify the link to the Italian site and your function should look like this:
function my_msls_options_get_permalink( $url, $language ) {
if ( 'it_IT' == $language ) {
$url = str_replace( '/product/', '/prodotto/', $url );
}
return $url;
}
add_filter( 'msls_options_get_permalink', 'my_msls_options_get_permalink', 10, 2 );
Nothing changes :/
This is the link in the italian version http://mysite.com/it/prodotto/oblo-ovale-t04/
and this when I switch to the english one (main site): http://mysite.com/prodotto/oval-porthole-t04/
In the english version “prodotto” should be replaced by “product”.
I inserted the code you provided into the function.php file of my theme.
Suggestion? 🙁
What about this one?
function my_msls_options_get_permalink( $url, $language ) {
if ( 'it_IT' == $language ) {
$url = str_replace( '/product/', '/prodotto/', $url );
}
elseif ( 'us' == $language ) {
$url = str_replace( '/prodotto/', '/product/', $url );
}
return $url;
}
add_filter( 'msls_options_get_permalink', 'my_msls_options_get_permalink', 10, 2 );
yeeeesss!! It works!
Many many thanks for this plugin and for you kind and quick support 🙂
Hi! Here I am again..sorry :/
Today I realized that the problem was solved only for single products but it remains for categories pages.
Eg, switching from EN to IT:
http://mysite.com/products/yacht-category/portholes/ EN
http://mysite.com/products/categoria-yacht/oblò IT
In the second link “products” should be replaced by “prodotti”
Same happens in IT to EN switch:
http://mysite.com/prodotti/categoria-yacht/oblò IT
http://mysite.com/prodotti/yacht-category/portholes/ EN
In the EN version “prodotti” should become “products”
Maybe I have to add more code somewhere else? allufertempesta.com
Thank you!
Just add 2 lines to the function:
function my_msls_options_get_permalink( $url, $language ) {
if ( 'it_IT' == $language ) {
$url = str_replace( '/product/', '/prodotto/', $url );
$url = str_replace( '/products/', '/prodotti/', $url );
}
elseif ( 'us' == $language ) {
$url = str_replace( '/prodotto/', '/product/', $url );
$url = str_replace( '/prodotti/', '/products/', $url );
}
return $url;
}
add_filter( 'msls_options_get_permalink', 'my_msls_options_get_permalink', 10, 2 );
Cheers,
Dennis.