Plugin Author
Chouby
(@chouby)
@n1mh
Can you try to comment those 2 lines in frontend/choose-lang.php line 29 ?
if (PLL_AJAX_ON_FRONT || false === stripos($_SERVER['SCRIPT_NAME'], 'index.php'))
$this->set_language(empty($_REQUEST['lang']) ? $this->get_preferred_language() : $this->model->get_language($_REQUEST['lang']));
done, but it is still failing.
I’m setting up a testing environment from scratch because my impression is that there is a lot of things here, multisite, multilanguage, themes, plugins, etc… and I want to be sure that languages work.
wait a minute! It worked!
I’m testing and I’ll say something in a minute…
Hi,
menu and footer widget works with twenty thirteen theme but with my paid theme only widgets change. Unfortunately, it means I will argue with support department. Do you have any idea about what is going on with it? Something I may use with the theme creators.
Thank you so much!
Plugin Author
Chouby
(@chouby)
The most frequent issue with themes menus is that their authors register a theme location in register_nav_menu
but don’t use the theme location when calling wp_nav_menu
.
ex taken from twenty twelve (which of course is correctly written π ), in functions.php
register_nav_menu( 'primary', __( 'Primary Menu', 'twentytwelve' ) );
in header.php
wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) );
The ‘theme_location’ argument ‘primary’ refers to the first argument in register_nav_menu. Without this argument, Polylang is lost.
The problem is that WordPress works when there is only one theme location and only one menu defined π But with Polylang you have several menus.
Did you need to comment the two lines I mentionned above to make this work? If yes, I would like to know what value you have in $_SERVER['SCRIPT_NAME']
and what are the server and PHP version you use.
Yes, I did comment the two lines you mentionned. Data are:
$_SERVER[‘SCRIPT_NAME’]=”/airback/”, subsite’s name.
apache version 2.2.22
php version 5.4.4
Thanks for your explanation. I’m going to dig into my paid theme seeking for nav_menu :).
Plugin Author
Chouby
(@chouby)
Well. I am expecting something like '/airback/index.php'
for $_SERVER['SCRIPT_NAME']
. I use the test to differentiate a standard page from wp-login.php
, wp-signup.php
, etc… (for which the language is not set from content or url but from cookie).
Could you tell me if $_SERVER['SCRIPT_FILENAME']
has the same issue (i.e 'index.php'
does not appear)?
sorry for the delay…
$_SERVER[‘SCRIPT_FILENAME’] has this value “/var/www/wbsgo.org/index.php”, so index.php appears.
Plugin Author
Chouby
(@chouby)
So you can uncomment the two lines and replace SCRIPT_NAME by SCRIPT_FILENAME (to enable the correct language on login, signup, etc…)
I will include the modification in v1.3 to be released next week. I googled a bit and found out that bugs were reported with $_SERVER[‘SCRIPT_NAME’] on some old Apache versions.
Thanks for your tests!
I’ve made that changes and menu still doesn’t change.
Thank you so much for your help! I will continue talking to theme’s developers.
Thanks,
diego
Plugin Author
Chouby
(@chouby)
This change is not for the menu but for the fact that the language loaded by Polylang was always the same whatever the page.
For the menu, the problem seems to be in your theme. Did you find the wp_nav_menu function in it?
I did find this function and register_nav_menu too:
$args = array("theme_location" => "main", "container" => false, "fallback_cb" => 'themeple_fallback_menu');
wp_nav_menu();
register_nav_menu($id, THEMETITLE.' '.$name);
I’ve swapped main for primary but menu doesn’t change.
And yes, I also believe it’s a theme issue…
Plugin Author
Chouby
(@chouby)
$args should be in wp_nav_menu like this
$args = array("theme_location" => "main", "container" => false, "fallback_cb" => 'themeple_fallback_menu');
wp_nav_menu($args);
it works!!!! I can’t believe it!!! π
Thank you! I’ve been with this problem five days and theme support don’t give an answer.