I encountered this problem when creating a wordpress topic and encountered a css style error. In fact, the operation is very simple as follows:
Add:
Register_nav_menus (array ('menu '=> _ ('menu ',''),));
Paste the navigation code in the topic navigation bar: <? Php wp_nav_menu ('Id = navbar');?>
However, a css style error occurs.:
The output format of this function is as follows:
Copy codeThe Code is as follows: <div id = "menubar">
<Ul class = "menus">
<Li class = "..."> <a href = "http: //.../"> Home </a> </li>
<Li class = "..."> <a href = "http: //.../"> menu item 1 </a> </li>
<Li class = "..."> <a href = "http: //.../"> menu item 2 </a> </li>
<Li class = "..."> <a href = "http: //.../"> menu item 3 </a> </li>
...
</Ul>
</Div>
It's okay to filter it out:
Change the code:Copy codeThe Code is as follows: <? Php
Echo str_replace ("</ul> </div>", "", ereg_replace ("<div [^>] *> <ul [^>] *> ", "", wp_nav_menu (array ('Theme _ location' => 'primary', 'echo '=> false ))));
?>