My WP site - How to generate separate classes/id's for each list item?

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

  1. #1
    Hi php people :)

    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'. Ok, so..

    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 (generated by wordpress not hard coded)? 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, and i do not write the list items in myself - wordpress generates them)

    Thanks v much :)

    Emma
     
    emmaburge, Jul 1, 2011 IP