WordPress.org

Ready to get started?Download WordPress

Forums

Add class=first, class=last (2 posts)

  1. valuxes
    Member
    Posted 5 years ago #

    I was just wondering if we can have a <li class="first"> and <li class="last"> in the core to distinguish the first and last post, category, page, etc. in a query_posts? It would help a lot in applying different CSS treatments for the first and last entry.

    For example, when I use:

    <?php wp_list_categories('show_count=1&title_li='); ?>

    the following code is generated:

    <li class="cat-item cat-item-4">...
    <li class="cat-item cat-item-11">...
    <li class="cat-item cat-item-23">...

    Instead, could we have the follwing generated:

    <li class="cat-item cat-item-4 first">...
    <li class="cat-item cat-item-11">...
    <li class="cat-item cat-item-23 last">...

    V

  2. vijayrajesh
    Member
    Posted 4 years ago #

    were you able to solve it. I need this solution too.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.