Skip to content

Instantly share code, notes, and snippets.

@georgestephanis
Forked from nikibrown/gist:3152904
Created July 20, 2012 21:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save georgestephanis/3153223 to your computer and use it in GitHub Desktop.
Save georgestephanis/3153223 to your computer and use it in GitHub Desktop.
Add somethign before and after every group of 4 posts...
<?php $tombstones = new WP_Query('category_name=tombstones&posts_per_page=-1'); ?>
<?php $counter = 0; ?>
<?php echo '<div class="slide"><h1>Beginning</h1>'; ?>
<?php if( $tombstones->have_posts() ) : while ( $tombstones->have_posts() ) : ?>
<?php $tombstones->the_post(); $counter++; ?>
<?php if ($counter % 4 == 0) echo '<h1>Ending</h1></div><div class="slide"><h1>Beginning</h1>'; ?>
<?php the_content(); ?>
<?php endwhile; endif;?>
<?php echo '<h1>Ending</h1></div>'; ?>
<?php wp_reset_postdata(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment