Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save techpulsetoday/cbf6e05b803997729ac2db281a67f8b9 to your computer and use it in GitHub Desktop.

Select an option

Save techpulsetoday/cbf6e05b803997729ac2db281a67f8b9 to your computer and use it in GitHub Desktop.

Revisions

  1. @thewirelessguy thewirelessguy renamed this gist Nov 5, 2013. 1 changed file with 0 additions and 0 deletions.
  2. @thewirelessguy thewirelessguy created this gist Nov 5, 2013.
    7 changes: 7 additions & 0 deletions Getting the last post in the WordPress loop
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    <?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';
    } ?>