Guest User

Untitled

a guest
Jan 23rd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. <?php
  2. // $the_query would just be a standard WP_Query
  3. if ( $the_query->have_posts() ) :
  4.  
  5. $counter = 1;
  6.  
  7. while ( $the_query->have_posts() ) : $the_query->the_post();
  8.  
  9. if ( $counter % columns == 1 ) {
  10. // do something at the start of your 'row'
  11. }
  12.  
  13. // some content
  14.  
  15. // Check if $counter/$columns is equal to an integer
  16. if ( is_int( $counter / $columns ) ) {
  17. // do something at the end of your 'row'
  18. }
  19.  
  20. $counter++
  21.  
  22. endwhile;
  23.  
  24. // Reset WP_Query() data
  25. wp_reset_postdata();
  26.  
  27. endif;
  28.  
  29. ?>
Add Comment
Please, Sign In to add comment