bedex78 wrote:Here's another method to direct the links correctly... This time using FILTER, so you can skip the 'Walker' argument in the wp_nav_menu function call.
- Code: Select all
add_filter('walker_nav_menu_start_el', 'qtrans_in_nav_el', 10, 4);
function qtrans_in_nav_el($item_output, $item, $depth, $args){
$attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : '';
$attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : '';
$attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : '';
// Determine integration with qTranslate Plugin
if (function_exists('qtrans_convertURL')) {
$attributes .= ! empty( $item->url ) ? ' href="' . qtrans_convertURL(esc_attr( $item->url )) .'"' : '';
} else {
$attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';
}
$item_output = $args->before;
$item_output .= '<a'. $attributes .'>';
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
$item_output .= '</a>';
$item_output .= $args->after;
return $item_output;
}
This worked for me, thank you really much Bedex... :*
For other people working with 2010 weaver: you have to add the code above in the theme file called: "2010functions.php".
Now the home link works fine.
Sooo the next issue is the search function. When you switch to any language and then you make a search, you get the search results in the default language.
AAAAAAARG :°(
I wrote emails both to Qian and to the author of 2010 weaver. The first one didn't reply, the second was very kind and demonstrated me this issues are not theme problems, but qTranslate problems. Infact, if you install a new wordpress blog with the standard twenty ten theme and put in the qTranslate plugin the home link is doing that bad thing, and also the search results. I hope there will be fixes for this in the next updates, because qTranslate is really nice and powerfull. I like really much the possibility to edit more languages as tabs in the same page or post.
Bedex, you know I love you. I hope you are a beautiful blonde girl; if not, I love you the same.
Our destinies are in your hands
