Position Flags in Nav Menus
-
Hi, I’ve added Multisite Language Switcher and it is working perfectly using English(American) and Vietnamese.
Currently the flags are in the footer, but I would like to move them to the navigation menus (I am using a one-page site built from Salient theme).
My site is here: http://sitebeta.d-gecko.com/en/
and here: http://sitebeta.d-gecko.com/vn/I’ve tried reading through other posts, but my knowledge of coding is so small that I’m still completely confused and lost as to how to get the flags into the navigation menus.
I would very much appreciate your help on this if you could please provide me step-by-step instructions 🙂
Cheers!
-
Hi,
please look for the call to wp_nav_menu in your functions.php and tell me the parameters used by this function so I can suggest you the configuration.
Cheers,
Dennis.Hi Dennis,
I did a search in the functions.php but there’s no call to wp_nav_menu.
I found this, but not sure if it’s what you’re looking for:
#-----------------------------------------------------------------# # Custom menu #-----------------------------------------------------------------# if ( function_exists( 'register_nav_menus' ) ) { register_nav_menus( array( 'top_nav' => 'Top Navigation Menu', 'secondary_nav' => 'Secondary Navigation Menu <br /> <small>Will only display if applicable header layout is selected <a href="'. admin_url('?page=redux_options&tab=4') .'">here</a>.</small>' ) ); } //dropdown arrows class Nectar_Arrow_Walker_Nav_Menu extends Walker_Nav_Menu { function display_element($element, &$children_elements, $max_depth, $depth=0, $args, &$output) { $id_field = $this->db_fields['id']; if (!empty($children_elements[$element->$id_field]) && $element->menu_item_parent == 0) { $element->title = $element->title . '<span class="sf-sub-indicator"><i class="icon-angle-down"></i></span>'; $element->classes[] = 'sf-with-ul'; } if (!empty($children_elements[$element->$id_field]) && $element->menu_item_parent != 0) { $element->title = $element->title . '<span class="sf-sub-indicator"><i class="icon-angle-right"></i></span>'; } Walker_Nav_Menu::display_element($element, $children_elements, $max_depth, $depth, $args, $output); } }Thanks so much for looking at this for me Dennis!
Cheers,
MatinYes, you’re right. It is of course register_nav_menu or register_nav_menus. Add this here to your functions.php:
function my_custom_menu_item( $items, $args ) { if ( function_exists ( 'the_msls' ) && 'top_nav' == $args->theme_location ) { $obj = new MslsOutput; $arr = $obj->get( 2 ); if ( !empty( $arr ) ) { $items .= '<li>' . implode( '</li><li>', $arr ) . '</li>'; } } return $items; } add_filter( 'wp_nav_menu_items', 'my_custom_menu_item', 10, 2 );Just change the html-code for your needs and read on here: https://github.com/lloc/Multisite-Language-Switcher/wiki/Generate-the-output#manipulate-the-navigation-menu
Cheers,
Dennis.Dennis, thank you so much.
Is there a specific line in functions.php that I should add the code you provided? Should it be added at beginning/end of #custom menu area?
I know you’ve had to repeat this to others a million times, but I really appreciate your help. Great plugin, excellent support!
Cheers,
MatinYou can ad it where you want. No problem!
Cheers,
Dennis.Worked perfectly! Thanks so much Dennis!!!
Cheers,
MatinVery good! Have fun!
The topic ‘Position Flags in Nav Menus’ is closed to new replies.