do_action( 'astra_related_posts_title_before' )
WP_Query posts loop.
Used $post_counter & ( $post_counter < $total_posts_count ) condition to manage posts in while loop because there is case where manual ‘post__not_in’ condition handling scenario fails within loop.
CASE EXAMPLE – If total posts set to 4 (where ‘post__not_in’ not used in WP_Query) so there is a chance that out of those 4 posts, 1 post will be currently active on frontend.
So what will happen in this case – Within following loop the current post will exclude by if condition & only 3 posts will be shown up.
To avoid such cases $post_counter & ( $post_counter < $total_posts_count ) condition used.