Home / loop / Conditionally display content on last post
  • How to Conditionally display content on last post

    conditionally-display-content-on-last-post

    Adding this snippet within the loop of your wordpress theme will let you display something only if it is on the last posts.

    wordpress snippet : PHP

    <>
    <?php if( ($wp_query->current_post + 1) < ($wp_query->post_count) ) { ?>
       <b>last post</b>
    <?php } ?>
    

    ( WordPress codex functions, hooks, in this snippet. )

    query, wp,