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>
Written by Rajesh Khatri
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Wordpress
Authors
Related Tags
#wordpress
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#