if ($wp_query->current_post +1 == $wp_query->post_count) {
// this is the last post
}
Change $wp_query to your own query variable if you made a new WP_Query object.
if ($wp_query->current_post +1 == $wp_query->post_count) {
// this is the last post
}
Change $wp_query to your own query variable if you made a new WP_Query object.