Support » Fixing WordPress » Change which menu is display in that location for a specific page

  • I have a website with multiple menus that I registered and created locations for. However if I’m on the homepage I need to set the menu location topmenu to display a different menu (cleanmenu) then normal.

    I think I can add something to the functions.php but I’m not sure exactly how to write it?

    if ( is_home() ) {
    //set topmenu to display cleanmenu
    }

    Am I thinking along the right lines here?

Viewing 3 replies - 1 through 3 (of 3 total)
  • esmi

    (@esmi)

    Forum Moderator

    Why not register a new menu location that is just for this page? Are you using a static front page or a page of posts?

    It is a static front page. I considered registering a new menu location just for this page. That is what I have done for three other sections on this site. But I did that a couple of months ago and now that I am going back to edit it I just thought maybe there was a quick way to change the menu this is displayed in a location without having to create a specific location.

    esmi

    (@esmi)

    Forum Moderator

    I think the only way to do this is to register a new menu location using register_nav_menu() so that you can then call it conditionally (if necessary) using wp_nav_menu().

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change which menu is display in that location for a specific page’ is closed to new replies.