• The site is just a testing site for now, which is: glockrockn.com

    My problem is when users fist land on the site the sidebar is rendered in an entry post tag that I’m using in a loop. Which breaks the side bars float. Then if the user refreshes everything is fine, the sidebar is rendered in it’s proper place. Here’s the index.php:

    <?php get_header(); ?>
    <!-- content start -->
    
    <div id="content-wrap">
      <div id="content">
    
         <?php $my_query = new WP_Query('category_name=new&posts_per_page=1');
      while ($my_query->have_posts()) : $my_query->the_post();
      $do_not_duplicate = $post->ID; ?>
        <!-- Do stuff... -->
    
        <div class="post-entries">
    
          <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    
               <h3 class="home-storytitle"><?php the_title(); ?></h3>
    
            	 <div class="top-image">
    
              		<div class="image-container">
    
                        <div style="background: url(/wp-content/uploads/<?php the_ID(); ?>_lightbox.jpg) no-repeat 0 0; width: 570px; height: 347px;">
    
                         <!--lightbox link -->
                            <a href="/wp-content/uploads/<?php the_ID(); ?>.png">&nbsp;</a>
                        <!--lightbox link -->
    
                        </div><!--background -->
    
              		</div><!--image-container -->
    
              <div id="new-image-shadow">&nbsp;</div>
    
              <div class="new-this-week"> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><img src="<?php bloginfo('template_url'); ?>/images/main_new_this_week.png" width="580" height="373" alt="<?php the_title(); ?>" /></a></div>
    
              <div class="meta">
              <h4><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php $s = substr(the_title('','',FALSE),0,15); ?>
    			<?php echo $s; if (strlen($s) >15){ echo '…'; } ?></a></h4>
    
              <p><?php the_date(); ?>  <?php edit_post_link(__('Edit This')); ?></p>
    
              <?php echo five_star_rating_func('star'); ?>
    
              </div><!--meta -->
    
            </div><!--top-image -->
    
    <div class="new_storycontent">
              <?php $myExcerpt = get_the_excerpt();
    if ($myExcerpt != '') {
        // Some string manipulation performed
    }
    echo $myExcerpt; // Outputs the processed value to the page?>
              <div class="clear">&nbsp;</div>
    </div><!--storycontent -->
          </div><!-- the ID -->
       </div><!--post-entries -->
    
    <?php endwhile; ?>
    
    <?php if (have_posts()) : while (have_posts()) : the_post();
      if( $post->ID == $do_not_duplicate ) continue;?>
    
    	<div class="post-entries">
    
    	  <div class="home-left">
    
       		<div class="post-image-container">
    
    		  <div class="post-image" style="background: url(/wp-content/uploads/<?php the_ID(); ?>.png) no-repeat 0 0;">
    
            		<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">&nbsp;</a> 
    
    		  </div><!--img -->
    
       		</div><!--post-image -->
    
        		<div class="post-image-shadow">&nbsp;</div>
    
    	  </div><!--home-left -->
    
       	  <div class="sub-title">
    
                <h4><?php the_title(); ?></h4>
                <p><?php the_time('F jS, Y') ?>  <?php edit_post_link(__('Edit This')); ?></p>
    
            <?php echo five_star_rating_func('star'); ?>
    
          </div><!--sub-title -->
    
          <div class="storycontent">
    
            <?php $myExcerpt = get_the_excerpt();
    if ($myExcerpt != '') {
        // Some string manipulation performed
    }
    echo $myExcerpt; // Outputs the processed value to the page?>    
    
          </div><!--storycontent -->
          <div class="clear">&nbsp;</div>
    	</div><!--post-entries -->	
    
     <?php endwhile; endif; ?>
    
        <div id="post_nav">
      <?php posts_nav_link(' — ', __('&laquo; Newer Posts'), __('Older Posts &raquo;')); ?>
        </div><!--post_nav -->
    
        <div class="clear">&nbsp;</div>
      </div><!--content -->
      <div id="container-foot">&nbsp;</div>
      <div id="foot-nav">
      	<?php wp_nav_menu(); ?>
        <div class="clear">&nbsp;</div>
      </div><!--foot-nav --></div>
    
    <?php get_sidebar(); ?>
    
    </div><!--content-wrap -->
    
    <?php get_footer(); ?>

    Thank you in advance for any and all help you can give me.

  • The topic ‘Template sidebar miss align on first visit’ is closed to new replies.