WordPress.org

Ready to get started?Download WordPress

Forums

How to style the menu? (3 posts)

  1. DennisMadsen
    Member
    Posted 3 years ago #

    Hello,

    I'm using the new menu in WP 3.0 and includes it into my theme this way:
    <?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>

    It's a horizontal top menu. Each li-element must have a different background-color. The HTML looks like this:

    <ul id="menu-menu" class="menu">
    	<li id="menu-item-6" class="menu-item menu-item-type-taxonomy current-menu-item current-category-ancestor menu-item-6"><a href="#">Item1</a></li>
    	<li id="menu-item-4" class="menu-item menu-item-type-post_type menu-item-4"><a href="#">Item2</a></li>
    	<li id="menu-item-13" class="menu-item menu-item-type-post_type menu-item-13"><a href="#">Item3</a></li>
    </ul>

    I was hoping that the first li-element got a class like menu-item-1, the next li-element menu-item-2 and so on. In that way, I could change the CSS for the different items. But instead the post/page id is used instead. Is there a way to do so or should I use jQuery?

  2. curlybracket
    Member
    Posted 3 years ago #

    I think jQuery is the proper way here.

  3. DennisMadsen
    Member
    Posted 3 years ago #

    Ok, thanks :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.