WordPress.org

Ready to get started?Download WordPress

Forums

Change which menu is display in that location for a specific page (4 posts)

  1. jwiere03
    Member
    Posted 6 months ago #

    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?

  2. esmi
    Forum Moderator
    Posted 6 months ago #

    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?

  3. jwiere03
    Member
    Posted 6 months ago #

    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.

  4. esmi
    Forum Moderator
    Posted 6 months ago #

    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().

Reply

You must log in to post.

About this Topic