• I am trying to have two different posts show up on the front page. One being the latest posts and the second being posts from a single category (product review). The problem that I am having is I don’t want the column with the latest posts to show up posts from the product review category. I thought I had the correct code from the codex but it is still showing up double posts. Here is the code that I have in m WP site.

    <div id="rightColumn">
    		<strong>Side x side  news</strong>
    		<div class="news">
    			<span class="top">&nbsp;</span>
    
                                           <?php if (have_posts()) : while (have_posts()) : the_post();
                                           if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>
    
    						<div class="block">
    							<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    							<p class="date"><?php the_time('F j, Y') ?></p>
    							<?php the_content('Read the rest of this entry &raquo;'); ?>
    							<p class="comments"><?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
    						</div>
    
    					<?php endwhile; ?>
    
    					<div class="navigation">
    						<div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div>
    						<div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div>
    					</div>
    
    				<?php else : ?>
    
    					<h2 class="center">Not Found</h2>
    					<p class="center">Sorry, but you are looking for something that isn't here.</p>
    
    				<?php endif; ?>
    
    			<p class="bottom">
    				<a href="#" class="older">Older News</a>
    				<a href="<?php echo get_settings('home'); ?>/?feed=rss2" class="rss">Subscribe to our news!</a>
    			</p></div>
    
    <!-- PRODUCT REVIEW -->
    
    		<strong>Product Reviews</strong>
    		<div class="news">
    			<span class="top">&nbsp;</span>
    
                                            <?php $my_query = new WP_Query('category_name=product-review');
    
                                            while ($my_query->have_posts()) : $my_query->the_post();
                                            $do_not_duplicate = $post->ID;?>
    
    						<div class="block">
    							<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    							<p class="date"><?php the_time('F j, Y') ?></p>
    							<?php the_content('Read the rest of this entry &raquo;'); ?>
    							<p class="comments"><?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
    						</div>
    
    					<div class="navigation">
    						<div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div>
    						<div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div>
    					</div>
    
    				        <?php endwhile; ?>
    
    			<p class="bottom">
    
    			</p></div>
    
    <!-- PRODUCT REVIEW END -->
  • The topic ‘Multiple Loops problem’ is closed to new replies.