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

Evolution History of computer Technology

Evolution History of computer Technology (HISTORY OF COMPUTER) Evolution of computer is a study of…

3 weeks ago

Maturity of Enterprise Architecture Practice

Maturity of Enterprise Architecture Practice Maturity of Enterprise Architecture Practice   DOWNLOAD

2 months ago

Computer Science Project Report Guidelines and Sample

Guidelines (Click Below to Download) SAMPLE 1 SAMPLE 2

8 months ago