Question

I'm new in Wordpress. I run the wordpress using xampp. Themes have a limited navigatiob menu, and I want to add two to four navigation menus with sub-menus in my theme. How can I do that? What file should I edit to add some navigation menus?

Please help me.

Thank you!

Was it helpful?

Solution

In your theme functions.php you should register the menu location by adding the following code:

register_nav_menus(
    array(
        'menu_1' => 'Menu name #1',
        'menu_2' => 'Menu name #2'
    )
);

For more instruction about the register_nav_menus() function you can visit the related codex.

Then in your theme files, you should use the following code:

wp_nav_menu(
    array(
        'menu' => 'menu_1'
    )
);

For more instructions about the wp_nav_menu() function you can visit the related codex.

Finally, the sub menu items can be manipulated from within the WordPress dashboard. You can see this video for more information.

OTHER TIPS

<?php register_nav_menu( 'menu-id-1', 'Menu Label1' ); ?> 

<?php register_nav_menu( 'menu-id-2', 'Menu Label2' ); ?>


<?php register_nav_menu( 'menu-id-3', 'Menu Label3' ); ?>

put this in your 'functions.php' file

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top