The wp_nav_menu () method is located in the wp-nodes des/nav-menu-templates.php file. This method is used to generate menus in the background. Before using this function, you must activate the theme 3.0 + menu function. The activation method is as follows: add if (function_ex
The wp_nav_menu () method is located in the wp-nodes des/nav-menu-templates.php file.
This method is used to generate menus in the background.
Before using this function, you must activate the theme 3.0 + menu function.
The activation method is as follows:
Add the following content to the functions. php file:
If (function_exists ('register _ nav_menus ') {register_nav_menus (array ('header-menu' => _ ('Navigation custom menu '), & apos; footer-menu & apos; = & apos; _ ('custom menu of page'), & apos; sider-menu & apos; = & apos; _ ('sidebar menu ')));}
A simple call is as follows:
''// Specifies the displayed navigation name. if not set, the first 'menu '??????????? => 'Header-menu ', 'container '?????? => 'Nav', // The container label name of the outermost layer is 'iner INER _ class' => 'primary', // The container class name of the outermost layer is 'iner INER _ id '??? => '', // The Container id value of the outermost layer is 'menu _ class '????? => 'SF-menu ', // ul Label class 'menu _ id '???????? => 'Topnav', // ul tag id 'echo '??????????? => True, // whether to print. the default value is true. if you want to use the navigation code as a value assignment, you can set it to false 'Fallback _ cb '???? => 'WP _ page_menu ', // The alternate navigation menu function. it is used to call 'before '????????? => '', // Display 'after '?????????? => '', // Display 'link _ before' after the tag in the navigation bar '???? => '', // Display 'link _ after' after the navigation link name '????? => '', // It is displayed before the navigation link name 'items _ wrap '????? =>'
', 'Dest '?????????? => 0, /// number of menu layers displayed. the default value 0 is to display all layers 'Walker '????????? => ''// Call an object definition display navigation menu);?>
This menu bar is generated based on whether or not to log on.
'logged-in-menu' ) );} else { wp_nav_menu( array( 'theme_location' => 'logged-out-menu' ) );}?>
Remove menu bar
Or
'' ) );??>
The generated menu css style is
Note: The category menu data called by the wp_nav_menu function comes from the "Appearance> menu" in the background. if you do not want to display a category menu, you only need to remove it from the background!