WordPress.org

Ready to get started?Download WordPress

Forums

012 Ps Multi Languages
[resolved] Nav Menu in different languages (12 posts)

  1. ferarayac
    Member
    Posted 1 year ago #

    Is there an option to translate or have multi language navigation menus as well.
    The plugin works great, but my menus will stay in the default language (EN) I need to have this in two other languages (ES and FR)
    Any idea how to do this.

    http://wordpress.org/extend/plugins/012-ps-multi-languages/

  2. Wang Bin
    Member
    Plugin Author

    Posted 1 year ago #

    hi
    is admin's menus ?

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

  3. ferarayac
    Member
    Posted 1 year ago #

    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

  4. Wang Bin
    Member
    Plugin Author

    Posted 1 year ago #

    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

  5. mettzed
    Member
    Posted 1 year ago #

    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?

  6. mettzed
    Member
    Posted 1 year ago #

    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?

  7. Wang Bin
    Member
    Plugin Author

    Posted 1 year ago #

    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 );

  8. ones
    Member
    Posted 1 year ago #

    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.

  9. mettzed
    Member
    Posted 1 year ago #

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

  10. agalazo
    Member
    Posted 1 year ago #

    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

  11. ferarayac
    Member
    Posted 1 year ago #

    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.

  12. ferarayac
    Member
    Posted 1 year ago #

    Issue resolve. Really appreciate all the troubleshooting!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.