Wordpress Themes support customizing menus and modifying css styles

Source: Internet
Author: User

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 ))));
?>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.