Support » Themes and Templates » How to have the two last post side by side on the bottom

  • I’ve noticed in a lot of blogs, such as healthytippingpoint.com, katheats.com there are two of the last posts on the bottom of the main screen. I personally haven’t played around with it, but my web developer guy doesn’t know how to do it either. Is this a simple plug-in or maybe there is something going over our heads.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Michael

    (@alchymyth)

    Forum Moderator

    you can use the $wp_query->current_post variable to check the position of a post in the loop (starts with 0 zero for the first post), and use this in a conditional statement to style the posts differently.
    also, to check the position from the end, you can use $wp_query->post_count which is the number of posts on that page.

    example, the second last post in the loop is (for a minimum of 4 posts on that page):

    if( $post_count >=4 && $wp_query->current_post == $post_count-2 ) echo 'second-last post';

    on katheats.com it looks to me like they just used a text widget and entered the link and photo..it doesn’t seem to be something that was pulled in from the loop. I could be way wrong. And it is on the bottom of each page, so I suspect she just wants to highlight these 2 posts.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to have the two last post side by side on the bottom’ is closed to new replies.