Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if( have_posts() ) {
- $ad_counter = 0;
- $after_every = x //change this to the number of posts;
- while( have_posts() ) {
- $ad_counter++;
- the_post();
- ?>
- <h2><?php the_title(); ?></h2>
- <?php
- // Display content
- $ad_counter = $ad_counter % $after_every;
- if( 0 == $ad_counter ) {
- echo '<h2 style="color:red;">Advertisement or custom content here</h2>';
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement