DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 963,673 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Cover image for Wordpress add menu in footer
Chetan Rohilla
Chetan Rohilla

Posted on • Originally published at readymadecode.com

Wordpress add menu in footer

In wordpress we can create our custom menu and can place at any place in our wordpress website.

First of all paste this code in your functions.php file located at website_root_path/wp-content/themes/your_theme/functions.php

register_nav_menus( array(
    'secondary' => __( 'Footer Menu', 'generatepress' ),
) );
Enter fullscreen mode Exit fullscreen mode

generatepress’ is your theme name and β€˜Footer Menu’ is your menu name. You can name it whatever you want and β€˜secondary’ is the menu id you can also name it whatever you want.

Now open your wordpress dashboard and navigate to Appearance -> Menus and add your menu items to the Menu you have created.

Now we will show the our menu in wordpress theme let say we want to show menu in footer. Then we will paste the code given below to our footer.php file located at website_root_path/wp-content/themes/your_theme/footer.php

wp_nav_menu( array( 
    'theme_location' => 'secondary', 
    'container_class' => 'footer-menu-class' ) );
Enter fullscreen mode Exit fullscreen mode

In the code above β€˜secondary’ is the menu id. And we have added in register_nav_menus β€˜footer-menu-class’ is the class of our menu container used to styling or adding css to our menu. There are also many options to our function wp_nav_menu.


Please like share subscribe and give positive feedback to motivate me to write more for you.

For more tutorials please visit my website.

Thanks:)
Happy Coding:)

Top comments (0)

🌚 Friends don't let friends browse without dark mode.

Just kidding, it's a personal preference. But you can change your theme, font, etc. in your settings.

The more you know. 🌈