Forked from alana-mullen/Detect the last post in the WordPress loop
Created
September 25, 2020 09:20
-
-
Save ValeriiVasyliev/bc549a5dd197c6ef85e128b6feb0c1e3 to your computer and use it in GitHub Desktop.
Detect the last post in the WordPress loop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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'; | |
} ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment