I am trying to set up a blog that inserts an ad between each post. Here’s a wire frame to help explain what I am trying to do. (wireframe) Ads are outlined in red. I am using Genesis framework.
I tried using custom post types to create an “Ad” post type but the problem is I can’t prevent the ads from duplicating on the same page. I use the
Here’s my loop that I am using. I run the genesis_after_entry hook to add the loop.
<?php $args = array( 'post_type' => 'ads', 'posts_per_page' => 1, 'orderby' => 'rand' );
$do_not_duplicate = array();
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
$do_not_duplicate[] = $post->ID;
the_content();
endwhile; ?>
Something’s obviously wrong because it’s still duplicating. Any help would be greatly appreciated!