Categories: wordpress

HOW TO REGISTER NAV MENU IN WORDPRESS?

The easiest way to add the nav manu in the dashboard is by using “register_nav_menus()” function and hook in the functions.php
The syntax is as follow:

function menu_name(){
“header” => “primary Menu”,
“footer” => “Footer Menu”
}

add_action(“init”,”menu_name”);

// in the above header and footer are the two menus that I am going to embade in my project. You can give other name and you can create as many menus as you want

After this process you have to hook the function by using add_action. You must use ‘init’ and ‘menu_name’ is the the of the function

SHOW MENU IN FRONTEND


if(has_nav_menu(“header){

wp_nav_menu(array(

‘menu_class’ => ‘ ‘,
‘menu_id’ => ”,

‘container_class’ => ‘ ‘,
‘container_id’ => ‘ ‘,

‘before’ => ”,
‘after’ => ”,

‘link_before’ => ”,
‘link_after’ => ”
));
}
?>

here ‘menu_class’ and ‘menu_id’ is class and class and id for ul respectively. ‘container_class’ and ‘container_id’ is the class and id for the div respectively.

jaminrai

Recent Posts

Computer Science Project Report Guidelines and Sample

Guidelines (Click Below to Download) SAMPLE 1 SAMPLE 2

2 months ago

Skype Closes Its Doors After 20 Years: A Look Back and the Apps That Faded with It

After 20 years of transforming global communication, Skype has officially ceased operations. Microsoft, which purchased…

9 months ago

The Duck and the Tortoise: A Tale of Patience and Teamwork

In a serene forest by the edge of a sparkling lake, there lived a cheerful…

10 months ago