Repeater Template
-
I’ve been going through codes on how to create loops without duplications for the repeater template, but I can’t seem to figure it out. Everything leads to duplicate posts when I click “Load More”
Does the repeater template detect arrays from the index/home page?
This is how my coding looks like so far. Is there something that I’m missing? Any leads would be helpful.
<!– HOME/INDEX PAGE – SHOWS FIRST & MAIN IMAGE / FIRST LOOP –>
<?php
$do_not_duplicate = array();
$my_query = new WP_Query(‘showposts=1’);
while ($my_query->have_posts()) : $my_query->the_post();
$do_not_duplicate[] = $post->ID;
?>
<div class=”post-<?php the_ID(); ?> static-image-wrapper”>
<?php echo get_the_image_link(array(‘image’,’My Image’),’medium’); ?>
<div class=”title-overlay”><h2>” rel=”bookmark” title=”Permanent Link to <?php the_title_attribute(); ?>”><?php the_title() ?></h2>
<!– <p class=”postmetadata”><?php the_time(‘M d, Y’) ?></p> –>
</div>
</div>
<?php endwhile; ?><!– HOME/INDEX PAGE – SHOWS TWO COLUMN THUMBNAILS WITHOUT DUPLICATION / SECOND LOOP –>
<?php
$args = array (
‘post_type’ => ‘post’,
‘posts_per_page’ => ’14’,
‘post__not_in’ => $do_not_duplicate
);$i = 0;
$my_query = new WP_Query($args);
if ($my_query -> have_posts()) : while ($my_query -> have_posts()) : $my_query -> the_post();
$do_not_duplicate[] = $post->ID;
if (!in_array( $post->ID, $do_not_duplicate )) continue; update_post_caches($posts); $i++;
?>
<div class=”span-12 post-<?php the_ID(); ?><?php if ($i == 2) { ?> last<?php } ?>”>
<h1 class=”title-header”>” rel=”bookmark” title=”Permanent Link to <?php the_title_attribute(); ?>”><?php the_title() ?></h1>
<div class=”post-format-content”>
<div class=”featured-image”><?php echo get_the_image_link(array(‘thumbnail’,’thumbnail-news’),’thumbnail’); ?></div>
<div class=”content-wrap”><h1 class=”entry-title”><?php the_title(); ?></h1></div>
</div>
<p class=”postmetadata”></p>
</div>
<?php if ($i == 2) { ?>
<div class=”archive-stack clear”></div>
<?php $i = 0; } ?>
<?php endwhile; endif; ?><!– REPEATER TEMPLATE –>
Same code as Second Loop
- The topic ‘Repeater Template’ is closed to new replies.