it's quite a pain making custom menus with qtranslate code being displayed in WP interface
i did the following edit to /wp-admin/includes/nav-menu.php:
- line 82: from esc_html( $title ); to esc_html( __($title) );
- line 236: encapsulate $title again with __(), so it'll be:
$output .= empty( $item->label ) ? esc_html( __($item->title) ) : esc_html( $item->label );
now i can actually see what i'm doing with custom menus...
:o)
****how can we incorporate this into qtranslate or WP?****
chudoff.a
Member
Posted 1 year ago #
I read fix this probem in Link
function qtrans_menuitem( $menu_item ) {
$menu_item->title = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $menu_item->title );
return $menu_item;
}
add_filter('wp_setup_nav_menu_item', 'qtrans_menuitem', 0);
forgot to check qtranslate forums...
thanks, chudoff.a, works perfectly
This filter fix doesn't work for me. Although the dashboard menu control looks nice and easy to read, the titles of the menus do not translate on the resulting website when I switch languages.
chudoff.a
Member
Posted 1 year ago #
BStofko, i know bat knonw't how fix problem =(
BStofko & chudoff.a,
as a matter of fact, the add_filter fix messed up with my page titles,
they lost their titles' translations
i deleted the fix, and got back to the core edit of nav-menu.php
I tried the core edit and it works perfectly, thanks for that.
forgot to mention, i'm using 2.5.14 and wordpress 3.0.4
- apparently this shouldn't be a problem with qtranslate 2.5.18
I am using WordPress 3.1 and qtranslate 2.5.18 and it is a problem.
chudoff.a
Member
Posted 1 year ago #
what you fix in core? sory my englsh so bad =(
bad english no problem, me no native english country too..
but, you read my post number 1??
line 82 and 236 of wp-admin/includes/nav-menu.php
chudoff.a
Member
Posted 1 year ago #
hm, not work for User area =(
chudoff.a
Member
Posted 1 year ago #
i have new fix this problem.
function qtrans_menuitem2( $item ) {
foreach ($item as $key=>$values){
$item[$key]->title = qtrans_useTermLib($values->title);
}
qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $item->title );
return $item;
}
add_filter('wp_nav_menu_objects', 'qtrans_menuitem2', 0);
function qtrans_menuitem( $menu_item ) {
$menu_item->title = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $menu_item->title );
$menu_item->title = qtrans_useTermLib( $menu_item->title );
return $menu_item;
}
add_filter('wp_setup_nav_menu_item', 'qtrans_menuitem', 0);
It fix user-panel and admin panel. Use =)
works like a charm, chudoff.a, thx
same code with error prevention* in the pastebin : http://pastebin.com/CxHd8BD3
* wrap everything with
if ( function_exists("qtrans_useTermLib") ) { CHUDOFF.CODE }
@brasofilo
I had tried chudoff.a's fix but it doesn't seem to automatically translate the menus in the front-end. Is this the case for you?
@bedex78
yes, same here... investigated the issue, but found no solution until now... will have to look at it in another time...
it would be nice if someone more knowledgeable in wp_nav_menu could jump in
petemurray
Member
Posted 7 months ago #
Workaround is to go to Appearance > Menu > then click Save Menu, which will update the menus with the new page titles