Navbar: if frontpage primary menu, else secondary menu

Goodmorning everyone,

I hope you are all doing fine today.

I am still working on the neverending story of my Full Page design but… we learn a lot !

But the very own nature of a full page design has a problem in it:

when on the frontpage, the Bootstrap Navbar uses the primary WordPress menu, which elements are #anchors. As soon as one navigates to a subpage however, those anchors don’t work anymore, obviously.

My question is: where can I put some php-code in the Navbar (I presume) to check whether the current page is frontpage.php? The logic that I have for now:

<?php
if (is_front_page()) {
// navbar must load primary WordPress menu
}
else {
// navbar must load secondary WordPressmenu
}
} ?>

I am also totally not sure where I should put that code.

Thanks for all your help !

kind regards,

Michael