Skip to content

Instantly share code, notes, and snippets.

View banna360's full-sized avatar
🏠
Working from home

Hasanul Banna banna360

🏠
Working from home
View GitHub Profile
@alana-mullen
alana-mullen / Detect the last post in the WordPress loop
Last active May 29, 2023 16:50
Detect the last post in the WordPress loop
<?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';
} ?>