WordPress add menu

To add a menu in WordPress menus you need to place the following code in your functions.php file:

//Add  menu
function register_my_menus() {
 register_nav_menus(
 array( 'footer' => __( 'Footer' ) )
 );
}
add_action( 'init', 'register_my_menus' );

And place this code where you want to show it in your theme:

<?php wp_nav_menu( array( 'theme_location' => 'footer' ) ); ?>

After this, go to WordPress admin and add a new menu in “menus”, connect to the location (in this example “footer”) where you want to show this menu items.

That’s it!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s