Support » Plugin: 012 Ps Multi Languages » Nav Menu in different languages

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Wang Bin

    (@ouhinit)

    hi
    is admin’s menus ?

    Please upload the languages (ES and FR) mo’file and po’file
    /wp-content/languages/

    Thanks Wang,

    What I’m looking to do, is I have a Top Menu that loads in the header.
    Will like to know how to change this dynamically with your plugin.

    My site: http://www.wyndhamherradura.com

    Cheers

    Plugin Author Wang Bin

    (@ouhinit)

    Hello, ferarayac

    I think this plug-in hook wp_page_menu and wp_nav_menu, if you can use wp_nav_menu or wp_page_menu , is supported from the plug-in.

    For example
    You can set the wp_nav_menu form
    http://www.wyndhamherradura.com/wp-admin/nav-menus.php

    My site is multilingual but my navigation menu on page is only in my first language. Is posible to translate Header Navigation of the theme?

    My header navigation didn’t changed to foreign langueage and it is caused by the code in header.php file. There is this code in header.

    <?php
    					wp_nav_menu( array(
    					 'sort_column' =>'menu_order',
    					 'container' => 'ul',
    					 'theme_location' => 'header-nav',
    					 'fallback_cb' => 'null',
    					 'menu_id' => 'navbar',
    					 'link_before' => '',
    					 'link_after' => '',
    					 'depth' => 0,
    					 'walker' => new description_walker())
    					 );
    				?>

    And there is this code in menu-walker.php (file included in theme)

    <?php
    /*
    Menu Walker Class
    */
    class description_walker extends Walker_Nav_Menu
    {
          function start_el(&$output, $item, $depth, $args)
          {
               global $wp_query;
               $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
    
               $class_names = $value = '';
    
               $classes = empty( $item->classes ) ? array() : (array) $item->classes;
    
    		   if ($item->menu_order == 1) {
    			 $classes[] = 'firstmenuitem';
    	       }
    
    		   if ($item->ID == get_theme_mod('lastmenuitem')) {
    			 $classes[] = 'lastmenuitem';
    		   }
    
               $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
               $class_names = ' class="'. esc_attr( $class_names ) . '"';
    
               $output .= $indent . '<li id="menu-item-'. $item->ID . '"' . $value . $class_names .'>';
    
               $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        ) .'"' : '';
               $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';
    
               $prepend = ' ';
               $append = ' ';
    		   //$prepend = '';
              // $append = '';
               $description  = ! empty( $item->description ) ? '<span>'.esc_attr( $item->description ).'</span>' : '';
    
               if($depth != 0)
               {
                   $description = $append = $prepend = "";
               }
    
                $item_output = $args->before;
                $item_output .= '<a'. $attributes .'>';
                $item_output .= $args->link_before .$prepend.apply_filters( 'the_title', $item->title, $item->ID ).$append;
                $item_output .= $description.$args->link_after;
                $item_output .= '</a>';
                $item_output .= $args->after;
    
                $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
                }
    }
    ?>

    Can somebody help me solve my problem with unchanged Header Navigation?

    Plugin Author Wang Bin

    (@ouhinit)

    I think you’ll be here route wp_nav_menu, and can be, so I do not know and do not want to test, please try.
    Example
    $output = apply_filters(“wp_nav_menu”,$output, $args );

    ones

    (@ones)

    I just doing it easy.
    <?php if ( function_exists( ‘get_load_language’ ) ) $currlang = get_load_language();
    wp_nav_menu( array( ‘container’ => ‘false’, ‘theme_location’ => ‘glowne’.$currlang.”, ‘menu_class’ => ‘font1’ ) ); ?>

    And i create two menus witch name glowneen and glownepl – two menus – two languages.

    mettzed

    (@mettzed)

    THX man 🙂 I modified my header.php and functions.php, made 2 nav menus and it works 🙂

    Hello,

    It wasn’t working for me but finally I know why.

    I use “ones” solution, thx men 🙂 but I needed to replace ‘theme_location’ => ‘glowne’.$currlang.” for ‘menu’ => ‘menu’.$currlang.”,

    Now it works perfectly

    So, herea re my findings.
    When I finish creating the spanish versions of my pages, I notice that 2 menu items change to Spanish without me doing anything. After checking what the reason was, I notices that the Title both in Spanish and English were not rename on the Menu, manually. So what I did was jsut remove the manual menu name I created on each page, rename the pages to the correct title I wanted and this fix the issue.

    Issue resolve. Really appreciate all the troubleshooting!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Nav Menu in different languages’ is closed to new replies.