Forums

style the last post listed on a page (3 posts)

  1. gmisen
    Member
    Posted 3 years ago #

    I've only found one link to someone addressing this and the site is down! cruel fate...

    I may be wording this wrong in my searches, but I want the last post that is displayed on my page (or the last two posts, etc) to be styled in a way differently than the rest.

    The problem is that there could theoretically be any number of posts on a page, (theres a page for job listings which could list only one or even none and a page for employees so the number of posts that are employee bios will continually grow) so i cant say style post 10 like so, etc etc

    I've found how to style the last post (being the most recent or latest post) but no way to style a position in the line thats relative to the number of posts listed.

    anyone know how to do this, or where to look?

    Thanks so much!!

  2. MichaelH
    Volunteer
    Posted 3 years ago #

    Can't remember where I saw this:

    lastest post in the current page of posts
    if( ($wp_query->current_post + 1) < ($wp_query->post_count) ) {
    echo("<hr />");
    } else {
    echo 'this is the lastest post in the current page of posts';
    }

  3. stoutdesign
    Member
    Posted 2 years ago #

    Just what I needed. Thanks!

    Anyone else looking for more detail can find info on the Role of WP_Query page.

Topic Closed

This topic has been closed to new replies.

About this Topic