Just in case you need a quick and easy way to only target the last post in a custom query, here you go!
| <?php | |
| $post_counter = 0; | |
| while ( $loop->have_posts() ) : $loop->the_post(); | |
| $post_counter++; | |
| $post_count = $loop->post_count; | |
| if ( $post_counter == $post_count ) { | |
| // Last post code | |
| } else { | |
| // Everything else | |
| } | |
| endwhile; | |
| wp_reset_query(); | |
| wp_reset_postdata(); | |
| ?> |