I have a pretty common loop:
global $wp_query, $wpdb;
if ( have_posts() )
{
while ( have_posts() )
{
the_post();
get_template_part(
'template_parts/content'
,get_post_format()
);
}
}
else
{
get_template_part( 'no_results' );
}
Now I need to add (for example) a <hr />
after each single post, but not the last one.
How would I determine if I currently got the second to last post in the current loop?
Note: This should work for paged loops as well.