WordPress Snippets at WPcustoms

Insert html between posts

A nice way to insert custom html code only between each posts. The last post is skipped so this is a smart solution to add a visual post divider or something similar.


/**
 * Snippet Name: Insert html between posts
 * Snippet URL: https://wpcustoms.net/snippets/insert-html-between-posts/
 */
  if (($wp_query->current_post + 1) < ($wp_query->post_count)) {
   echo '
Post Divider
'; }