A way to know if the loop has hit the last post available
-
I would think this topic would come up all the time, but I’m not seeing any answers searching Google or these forums. All I want to do is find a way to conditionally execute certain code if the loop has hit the last post available. For example:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php
the_content('Read the rest of this post >');
if (!last_post()) {
echo "<hr />";
}
?>
<?php endwhile; endif; ?>
The last_post() function does not exist; it is what I am looking for a way to write. All this would accomplish is to exclude the horizontal divider from the very bottom of the page. Anyone have any ideas??
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘A way to know if the loop has hit the last post available’ is closed to new replies.