Happy to hear that @chouby. We’ll test that also.
hi,
i have an “Notice: Trying to get property of non-object” error when saving/publishing a post.
this line is the problem:
[code]public function get_translation(...) {
$slug = $this->get_language($lang)->slug;
....
}[/code]
it throws an error with a custom post type i use to add field sets to other (custom) post types with the plugin “Advanced Custom Fields”.
is it possible to add a fallback? for me that works for the moment, but for sure its not a nice solution:
[code]if(empty($this->get_language($lang)->slug)) {
$slug = 'de';
} else {
$slug = $this->get_language($lang)->slug;
}[/code]
Plugin Author
Chouby
(@chouby)
Thanks for reporting this. I could reproduce and debug it. This is the result of some conflict between the WPML compatibility mode of both ACF and Polylang. I will fix this in the next release.
I get an error message with the latest (1.2.3) version on WP 2.7.1 with the Atahualpa theme:
Warning: Invalid argument supplied for foreach() in […]/wp-content/plugins/polylang/frontend/frontend-nav-menu.php on line 144
$menus in the function at that position is no array apparently but is treated as one. I have made a quick fix by making an
if(is_array($menus)) {
// foreach code goes here
}
around it, but that’s not more than a dirty hack.
Yup, I’m getting the same thing with with the stock Twenty Ten theme, just seems to be some missing braces:
public function nav_menu_locations($menus) {
if (is_array($menus))
$theme = get_option('stylesheet');
foreach ($menus as $loc => $menu) {
if (!empty($this->options['nav_menus'][$theme][$loc][$this->curlang->slug]))
$menus[$loc] = $this->options['nav_menus'][$theme][$loc][$this->curlang->slug];
}
return $menus;
}
…the indentation suggests that there should be braces with the is_array() conditional so that the foreach is inside it to me?
Plugin Author
Chouby
(@chouby)
Yes that’s this… That’s not a dirty hack as it is the only way to fix if you don’t use custom nav menus.
I included the fix (with some others) in the development version (1.2.3.2).
http://downloads.wordpress.org/plugin/polylang.zip
Cool, thanks for the confirmation. Confused the hell out of me before I spotted the missing brackets (“But it’s *uninitialised*! How can it be an array?!”) 😀
I have encountered an issue during the upgrade from 1.1.6. My custom menus remain in the default language (French) even I have custom menu set for every language (Fr, En and Chinese). It’s obviously a theme issue as when I’m switching back to Twenty Twelve, the problem is fixed.
Here is how I am register my menus in functions.php
function register_my_menus() {
register_nav_menus(
array(
'header-menu' => __( 'Header Menu' ),
)
);
}
add_action( 'init', 'register_my_menus' );
and in my template (ie. page.php):
<nav id="nav" role="navigation">
<?php wp_nav_menu( array('header-menu' => 'Header Menu') ); ?>
</nav>
Plugins in use:
jQuery Smooth Scroll
kt-cleanpress
Quick Page/Post Redirect Plugin
My question: what’s the new, optimal recommended markup to display the menu when we use Polylang ?
Thank you.
Plugin Author
Chouby
(@chouby)
The wp_nav_menu call is wrong. Here is the correct code
<nav id="nav" role="navigation">
<?php wp_nav_menu( array('theme_location' => 'header-menu') ); ?>
</nav>
See wp_nav_menu usage: http://codex.wordpress.org/Function_Reference/wp_nav_menu
I really can’t imagine how it could work with Polylang 1.1.6!
Note: The problem is that this buggy code can work without Polylang. Because if you don’t provide the theme_location argument, WordPress fallbacks to the first registered location. And if there is one unique location, you don’t notice the code is buggy 🙁 But with Polylang the location is no more unique… This is one of the most common mistake I find in themes.
Thanks for the quick reply. I am happy to see that this is one of the rare occasions that the simplest fix without any deeper understanding of the whole architecture turned out to be an actual solution 🙂
Thanks and keep up the good work! Polylang is a great plugin!
Thank you for the quick reply. I have made the change and it worked.
I had the warning problem […]/frontend-nav-menu.php on line 144 to
The 1.2.3.2 version solved the problem for me.
Thank you.
Hello Chouby, I have the same error of huppellepup. Have you got a fix to this problem ?
Plugin Author
Chouby
(@chouby)
hi,
i’ve found a bug in the quick-edit-function of wordpress.
– i have 2 lanugages, german and english
– i have e.g. a posts in this 2 languages (custom post type)
– all is working correct, now the problem:
1) first i edit an english post –> OK
2) now i edit a german post –> the language dropdown show english as selected
saving now will save this germn post as english and destoys the connection between the both posts