Get a free trial // Grow your CSS skills // Land your dream job

[Solved] Adding Classes to Individual List Items Dynamic

  • # January 5, 2010 at 12:22 pm

    Okay. Here’s what I’m trying to do. this is a wordpress question

    I have a navigation that is being dynamically generated by word press function list_pages & list_categories. Becuase of this I can assign a styling to the UL or LI that gets dynamically generated. HOWEVER, I’m trying to create indivual rollover graphics for each List item created. How do I assign classes to specific dynamically generated (li) items?

    Look at how I created the navigation located on the top. They are hardcoded in the sidebar.php page. I want a similar effect happening to the lower navigation on the page that is being dynamically generated. thanks!

    # January 5, 2010 at 12:29 pm


    I think I just figured it out. Thanks to firebug I was able to see that a class gets created for each list_pages and List_cat

    ie: class=" cat-item cat-item-5"

    I’ll just style those generated classes.

    # January 5, 2010 at 1:01 pm

    Indeed…and just so you know, there is a plugin that will append ‘first’ and ‘last’ class to the respective LI’s. … ist-pages/

    There is also a way to generate "even" and "odd" when it comes to posts.

    Btw, if you fixed the problem, edit your topic to say [SOLVED] so other users know. :mrgreen:

    # January 5, 2010 at 1:50 pm

    word. thanks for the plugin link!!

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed