0

So I want to have a normal menu on the home page but on the other pages, I want "hamburger" menus! I've searched for a plugin but all of the menu plugins were more like to edit the mobile menu or had an absolute different purpose.So my question is does anyone have a solution for this?

2 Answers 2

0

The easiest would be to serve 2 different menus and assign them different css classes, so you can style them differently.

if ( is_home() ) {
    // use home menu
    wp_nav_menu( array( 'menu' => 'home', 'menu_class' => 'menu_home' );
} else {
    // use other menu
    wp_nav_menu( array( 'menu' => 'nohome', 'menu_class' => 'menu_no_home' );
}

I think, a plugin would make it more complicated than needed.

2
  • The problem is that I'm a newbie to web design (this is my 4th wp site) so to style only the menu of a page is over my skills... This is the reason why I was looking for plugins. So I understand that this creates to separate menus, but how should I change the css of the menu? Thanks Feb 27, 2018 at 10:41
  • This doesn't create menus, this shows menu_locations. Where it says 'home/nohome' that is the name of a menu location. You can also enter the NAME of a menu in there, which you define through WP admin panel. The classes are listed in menu_class, which means, the output of the menus have a different class, and thus you can style them differently.
    – Beee
    Feb 27, 2018 at 10:47
-1

Create New menu for other pages and add condition on header where you are displaying your main manu

if( is_front_page() && is_home() ) { wp_nav_menu( array( 'theme_location' => 'home', ) ); } else { wp_nav_menu( array( 'theme_location' => 'new', ) ); }

Your Answer

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

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