Multilingual Text
wp_nav_menu doesn't change with multilingual plugin (3 posts)

  1. mdonato
    Posted 3 years ago #

    Dear all,

    I would like to swicth the menu translation on language changed.
    How can I do that?
    I'm looking inside nav-menu-template.php and wp_nav_menu function for a way to change the single item with something like Multilingual_Text::Title(); but for now I haven't found a solition, do you have any suggestions?
    Thanks in advance for your reply,



  2. Galgana
    Posted 3 years ago #

    I have the same problem ... I'm still looking, I think we fit a function in the php file of the plugin. It should look like the function that replaces the headlines, but the wp_nav_menu function generates a more complex code. I will keep you informed!

  3. mdonato
    Posted 3 years ago #

    Hi, in the meantime I have found a solution:

    1. Add this method in the plugin code: multilingual-text.php:

    static function PostTitle($postTitle)
    	self::$title_multilingual = true;
    	if ( strlen($postTitle) == 0 ) return;
    	return $postTitle;;
    	//self::$title_multilingual = false;

    2. Edit wp-includes\post-template.php -> function start_el(...) change this row from:

    $output .= $indent . '<li class="' . $css_class . '"><a href="' . get_permalink($page->ID) . '">' . $link_before . apply_filters( 'the_title', $page->post_title, $page->ID ) . $link_after . '</a>';


    $output .= $indent . '<li class="' . $css_class . '"><a href="' . get_permalink($page->ID) . '">' . $link_before . apply_filters( 'the_title', Multilingual_Text::PostTitle($page->post_title), $page->ID ) . $link_after . '</a>';

    And the problem is solved.
    If someone has found a better solution, please let me know.


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Multilingual Text
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic