<?php if (($wp_query->current_post +1) == ($wp_query->post_count)) { echo 'This is the last post'; } ?> <?php if (($wp_query->current_post +1) != ($wp_query->post_count)) { echo 'This is the not the last post'; } ?>