I'm trying to add a widget area in between posts on the home page. I got them to show right where I want them, after the first post. The problem is that the first two posts are duplicated. The same post that shows above the new widget area is also shown after the widget area. If I take out the call for widget code and just place regular ad code then the posts don't duplicate. This only happens when I call for the widget. I'm not sure how else I could fix this.
Here's what my code looks like in index.php
<?php $postnum = 1; $showads = 1; $counter = 1; ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<article class="article">
<div class="post-single post_box">
<header>
<div class="headline_area">
<h2 class="entry-title"><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<?php if($options['mts_headline_meta'] == '1') { ?>
<div class="headline_meta">
<p class="theauthor"><?php _e('By ', 'mythemeshop'); the_author_posts_link(); ?></p>
<p class="themeta"><span class="thetime"><?php the_time('F j, Y'); ?></span><span class="thecategories"><?php the_category(' ') ?></span><span class="thecomments"><a href="<?php comments_link(); ?>" rel="nofollow"><?php comments_number('No comments','1 Comment','% Comments'); ?></a></span></p>
</div>
<?php } ?>
</div><!--.headline_area-->
</header>
<?php if($options['mts_thumbnails'] == '1') { ?>
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" rel="nofollow"><?php if ( has_post_thumbnail() ) { echo '<div class="featured-thumbnail">'; the_post_thumbnail('thumbnail', array('title' => '')); echo '</div>'; } ?></a>
<?php } ?>
<div class="format_text entry-content">
<?php the_excerpt(); ?>
<p><a href="<?php the_permalink() ?>" class="readmore" rel="nofollow">Read More...</a></p>
</div>
</div><!--.post-single-->
</article>
<?php if ($postnum == $showads) { ?>
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Hot-Widget") ) : ?><?php endif; ?>
<?php } $postnum++; ?>
<?php endwhile; else: ?>
If I add a normal ad code in between the two lines below, then the posts aren't duplicated but whenever I call for the widget then the posts are duplicated.
<?php if ($postnum == $showads) { ?>
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Hot-Widget") ) : ?> <?php endif; ?>
<?php } $postnum++; ?>
Here's what my page looks like now http://carrenomedia.com/rp
Here's the link to code for the Recent/Popular posts widget http://pastebin.com/YbMhKAMV