0

I dont want to have dropdown (select - options) in my wordpress menu, even in mobile or lower width devices. I know I can use css to hide it, but I want to remove it at all. I googled for an hour and I found that I should use a custom walker on Roots!!!! but I dont know whats that and how. please help me, I am a newby.

4
  • Which Theme do you use? Commented Jul 20, 2014 at 8:17
  • meadowhill - wordpress.org/themes/meadowhill
    – biji buji
    Commented Jul 20, 2014 at 13:01
  • In the js/functions.js exists a function initMainNavigation. This function creates the dropdown button.
    – user4264
    Commented Aug 19, 2016 at 1:43
  • I'm not entirely understanding your situation. May you please elaborate? Add pictures to give a better visual reference on where you are. Commented Aug 19, 2016 at 2:37

3 Answers 3

2

We can use depth parameter of wp_nav_menu to set how many levels menu walker traverses.

wp_nav_menu( array( 'menu_id'=>'nav', 'theme_location'=>'header-menu' , 'depth' => 1) );

You can create a child theme so that updates won't override during updates.

Create child theme and copy code from header.php of parent theme then replace the code

 wp_nav_menu( array( 'menu_id'=>'nav', 'theme_location'=>'header-menu' ) );

with the above code.

More Info: child theme

1

Since WP v3.3.0 you can use filter wp_nav_menu_args to alter arguments of function wp_nav_menu that used to display a navigation menu. Add this code in functions.php of your theme files. You can change functions name wpse155177_nav_menu_args.

/**
* @see wp_nav_menu()
*
* @return array $args Array of wp_nav_menu() arguments.
*/
add_filter( 'wp_nav_menu_args', 'wpse155177_nav_menu_args', 1, 1 );
function wpse155177_nav_menu_args( $args )
{
    //lookup theme_location ie: header-menu
    if ( isset( $args['theme_location'] ) && 'header-menu' == $args['theme_location'] ) {
        $args['depth'] = 1; //levels of the hierarchy are to be included
    }

    return $args;
}
0

Simply try to move in menu settings "menu voices"(pages as :home, who we are, what to do, etc) alling them one under another.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.