hl-p7w
Last Updated: February 25, 2016
·
448
· rajeshkhatri13

Wordpress navigation register and how to call?

Add below code in function.php

function registermymenus() {
  registernavmenus(
    array(
      'header-menu' => _( 'Header Menu' ),
      'extra-menu' => _( 'Extra Menu' )
    )
  );
}

addaction( 'init', 'registermy_menus' );
</code></pre>

<h2>Add below code in <i>template file</i></h2>


<?php wpnavmenu( array( 'theme_location' => 'header-menu' ) ); ?>
</code>
</pre>

For adding class in menu


<?php wpnavmenu( array( 'themelocation' => 'header-menu', 'menuclass' => 'topnav', ) ); ?>
</code></pre>