Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter eilotshai

    (@eilotshai)

    Ok i found the solution
    For those who would like to have 2 differents menu 1 for Mobile device and One for Desktop using the twenty fourteen child-theme here is the solution

    1. in your function.php

    function register_my_menu() {
      register_nav_menu('mobile-menu',__( 'Menu Mobile' ));
    }
    add_action( 'init', 'register_my_menu' );

    2. Go in your admin panel and create a new menu

    3. in your header.php

    <?php if ( wp_is_mobile() ) {
    				  		echo wp_nav_menu( array( 'theme_location' => 'mobile-menu', 'menu_class' => 'nav-menu' ) );
    					}
    					else {
    						echo wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) );
    					}?>

    And it should be done!

Viewing 1 replies (of 1 total)