WordPress.org

Ready to get started?Download WordPress

Forums

post repeated in two column magazine theme (2 posts)

  1. DrGizmondo
    Member
    Posted 4 years ago #

    Hi all I have cooked uo a custom magazine theme and am now working out some of the kinks and bugs, one that I have recently noticed is that post from the bottom of column 1 are repeated at the top of column 2. This as I hope you can imagine is quite annoying.

    This is the code that I am using for my homepage, I have looked through it and cannot see why this is hapening, so I was hoping that comeone from the community would be able to help me out.

    <?php get_header(); ?>
    
    	<div id="content">
    
    <div id="feat_section">
    
    	<?php if (have_posts()) : ?>
    
    <!---FEATURE LOOP STARTS--->
    
    <?php query_posts('cat=174&showposts=1');
    $ids = array();
    while (have_posts()) : the_post();
    $ids[] = get_the_ID(); ?>
    
      <div class="feat_title">
    
                            <div class="feat_title">
    			<div class="post" id="post-<?php the_ID(); ?>">
    				<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    
                              </div>
    
    <div class="post_author">
    <p>By <?php the_author_posts_link(); ?> | <?php the_date ?><?php the_time('j/m/y | g:i A') ?></p>
    
    </div>
    
    				<div class="entry">
    
    <?php if( get_post_meta($post->ID, "feature-img", true) ): ?>
    <div class=”homeimg”>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><img style="float:left;margin: 10px 10px 10px 0;height:350" src="/wp-content/uploads<?php $values = get_post_custom_values("feature-img"); echo $values[0]; ?>" alt="thumbnail" height="350" width="635" /></a>
    </div>
    <?php else: ?>
    <?php endif; ?>
    
    				</div>
    
    			</div>
    
    <?php 
    
    endwhile;
    ?>
    
    </div>
    
    </div>
    
    <!---FEATURE LOOP END--->
    
    <!---NEWS - LEFT COLUMN LOOP START--->
    
    <div id="news_section">
    
    	<div id="column_01">
    
    <?php $posts = get_posts('cat=-174,-16, -17&numberposts=10&offset=0');
    foreach ($posts as $post) : start_wp(); ?>
    <?php static $count2 = 0; if ($count2 == "10") { break; } else { ?>
    
     <div class="post" id="post-<?php the_ID(); ?>">
    				<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    
    <div class="home_author">By <?php the_author_posts_link(); ?> | <?php the_date ?><?php the_time('j/m/y | g:i A') ?>
    
    </div>
    <?php if( get_post_meta($post->ID, "Image", true) ): ?>
    <div class=”homeimg”>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><img style="float:left;margin: 0 10px 10px 0;height:233px" src="/wp-content/uploads<?php $values = get_post_custom_values("Image"); echo $values[0]; ?>" alt="thumbnail" height="233" width="297" /></a>
    </div>
    <?php else: ?>
    <?php endif; ?>
    
    				<div class="entry">
                                     <div class="post-excerpt">
                                       <?php the_excerpt(); ?>
                                     </div>
    				</div>
    
    			</div>
    
    <?php $count2++; } ?>
    <?php endforeach; ?>
    </div>
    
    <!---NEWS - LEFT COLUMN LOOP ENDS--->
    
    <!---NEWS - RIGHT COLUMN LOOP START--->
    
    	<div id="column_02">
    
    <?php $posts = get_posts('numberposts=10&offset=12');
     foreach ($posts as $post) : start_wp(); ?>
    <?php static $count3 = 0; if ($count3 == "10") { break; } else { ?>
    
     <div class="post" id="post-<?php the_ID(); ?>">
    				<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    
    <div class="home_author">By <?php the_author_posts_link(); ?> | <?php the_date ?><?php the_time('j/m/y | g:i A') ?>
    
    </div>
    
    <?php if( get_post_meta($post->ID, "Image", true) ): ?>
    <div class=”homeimg”>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><img style="float:left;margin: 0 10px 10px 0;height:233px" src="/wp-content/uploads<?php $values = get_post_custom_values("Image"); echo $values[0]; ?>" alt="thumbnail" height="233" width="297" /></a>
    </div>
    <?php else: ?>
    <?php endif; ?>
    
    				<div class="entry">
                                     <div class="post-excerpt">
                                       <?php the_excerpt(); ?>
                                     </div>
    				</div>
    
    			</div>
    
    <?php $count3++; } ?>
    <?php endforeach; ?>
    </div>
    </div>
    
    <!---NEWS - RIGHT COLUMN LOOP ENDS--->
    
    	<?php else : ?>
    
    		<h2 class="center">Not Found</h2>
    		<p class="center">Sorry, but you are looking for something that isn't here.</p>
    		<?php include (TEMPLATEPATH . "/searchform.php"); ?>
    
    	<?php endif; ?>
    
    	</div>
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    I do hope some one can help me with this and I thank you in advance.

  2. keighl
    Member
    Posted 4 years ago #

    With just a quick glance, the problem may be related to the difference in cat parameters from the first column and second column. In the first, you're limiting the query by cat, and in the second all cats are included. Regardless of offset, the number of posts in the different categories might throw it off. If you set some specific categories in column two, might work better.

    Not exactly sure, though. I need to look closer.

Topic Closed

This topic has been closed to new replies.

About this Topic