Quantcast
Channel: User Michael - WordPress Development Stack Exchange
Viewing all articles
Browse latest Browse all 44

Answer by Michael for Can we count the Wordpress Loop

$
0
0

$wp_query->current_post is the build-in loop counter, starting with 0 zero for the first post in the loop.

so the line some code to be executed could translate to:

<?php if( $wp_query->current_post > 0 && $wp_query->current_post % 5 == 0 ) { ?> some code to be executed<?php } ?>


Viewing all articles
Browse latest Browse all 44

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>