简体   繁体   中英

How to apply different style to Wordpress wp_nav_menu()

I am using Wordpress 3.0.Is it possible to apply different style class to wordpress wp_nav_menu()? Currently five pages for me and I would like to apply in following order.

<ul>
      <h2>
        <li><a href="#">Example1</a> </li>
      </h2>
      <span>
      <li><a href="#">Example2</a></li>
      </span>
      <h4>
        <li><a href="#">Example3</a></li>
      </h4>
      <h3>
        <li><a href="#">Example4</a></li>
      </h3>
      <h5>
        <li><a href="#">Example5</a></li>
      </h5>
</ul>

that isn't semantically correct html - perhaps you want to add a class to each li instead?

WP adds classes to its generated LIs like so:

page_item page-item-27

where the number is related to the ID of the article/page.

css:

.page-items-27 {
    color:#fff;
    background:blue;
    font-size:14px;
    // etc
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM