Create a custom meu with location and a home page
-
Hi everyone,
I’m looking for the code to:
1. check if a menu with name ‘main-menu’ exists. If not, create it.
2. assign it the menu location primary
3. add a ‘home’ link to the menuSo I’m looking for something like this but this code isn’t working:
if ( !has_nav_menu( 'main-menu' ) ) { register_nav_menu('main-menu',__( 'Main menu' )); //somehow add a link to the homepage to main-menu add_action( 'init', 'main-menu' ); }
Already thanks for all the help.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Create a custom meu with location and a home page’ is closed to new replies.