displaying duplicate posts.
-
Hi there,
I’m trying to avoid duplicate posts… but once I hit “view more”, I get many duplicates… please help me ?? as I m not sure what I’m doing wrong, I set up the right offset and my code is below… I would appreciate your prompt response as I need to deliver this pretty soon. thanks
[ Moderator note: code fixed. Please wrap code in the backtick character or use the code button. ]
<?php $i=0; $j = $wp_query->post_count; ?> <?php $post_ids = array(); /* stop repeating posts */ $query = new WP_Query('cat=-1'); ?> <?php if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); $post_ids[] = get_the_ID(); /* stop repeating posts */ ?> <?php include( get_stylesheet_directory().'/postBoxLandscape.php'); ?> <!-- end article --> <?php if ( 0 == ++$i%3 && $i < $j ) { echo '</div></div><div class="col-sm-4"><div class="row">';} ?> <?php endwhile; ?> </div> </div> <!--- CLOSE GRID COLUMN SYSTEM FOR THE POST LOOPS ---> <?php endif; ?> </div> <!-- end #main --> <div class="col-sm-12 clearfix"> <?php if($post_ids){ //Implode the posts and set a variable to pass to our exclude param. $postsNotIn = implode(",", $post_ids); } // this is the ajax loader more videos for the homepage - plugin ajax load echo do_shortcode( '[ajax_load_more post_type="post" post_format="video" category="videos" tag="videos" offset="9" posts_per_page="9" pause="true" scroll="false" button_label="Ver Mas Videos"]' ); ?>
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘displaying duplicate posts.’ is closed to new replies.