Automatically assign a seperate class to each of my WP-generated menu's list items??

Discussion in 'WordPress' started by emmaburge, Jul 1, 2011.

  1. #1
    Hi everyone, i posted similar in the php forum but then thought this actually may be a more relevant place..

    I'm working with this wordpress theme: http://www.cadengrant.me/wpthemes/?theme=PictureThis

    It uses custom menus to display the list items on the left of the screen, shown as the black 'tabs'.

    Here is the code:

    <div class="navigation">
    <?php if ( has_nav_menu( 'primary-menu' ) ) { /* if menu location 'primary-menu' exists then use custom menu */ ?>
    <?php wp_nav_menu( array( 'theme_location' => 'primary-menu', 'menu_class' => 'menu', 'container' => 'ul' ) ); ?>
    <?php } else { /* else use wp_list_pages */ ?>
    <ul class="menu">
    <?php wp_list_pages( array('title_li' => '')); ?>
    </ul>
    <?php } ?>
    </div>

    Can i ask – would it be possible to somehow assign a separate class to each of the navigation menu’s list items? perhaps some auto incrementing number for the class, that i’d include in my code with php?

    (I want to assign diff background images to diff list items is why i ask)

    Thanks v much
     
    emmaburge, Jul 1, 2011 IP