• Resolved jezthomp

    (@jezthomp)


    I have the following code which is working perfectly apart from the first post, the eldest post…

    This code goes on the home page set up as post page, and on single.php page for when you click on one of the news items it shows in the 3rd col as well as keeping the rest of the news posts on in the 2nd.

    All works all posts show up apart from the first one…

    <?php
    /**
     * @package WordPress
     * @subpackage Coded Pictures
     */
    
    /*
    Template Name: Home News Page
    */
    ?>
    
    <?php get_header(); ?>
    
    <?php get_sidebar(); ?>
    
    <div id="grid_2">
    
    <div id="news_links">
        <ul>
        		<?php $my_query = new WP_Query('cat=1');
    while ($my_query->have_posts()) : $my_query->the_post();
    $do_not_duplicate = $post->ID; $data = get_post_meta( $post->ID, 'key', true );?>
       		<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
       		<span>
    
    				<li><?php the_time('F jS, Y') ?></li>
    				<li><?php the_title(); ?></li>
    				<li><?php echo $data[ 'place' ]; ?></li>
    				<li><?php echo $data[ 'location' ]; ?></li>
    		</span>
    		</a>
    			<?php endwhile ?>
        </ul>
      </div>
      <!--news_links-->
    
    <div class="clearFix"><!--x--></div>
    </div>
    <!--grid_2-->
    
    <?php if (have_posts()) : while (have_posts()) : the_post();
    if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); $data = get_post_meta( $post->ID, 'key', true );?>
    
    <div id="grid_3">
    
    		<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    			<h2><?php the_title(); ?></h2>
    
    			<?php the_content('Read the rest of this entry &raquo;'); ?>
    
    		</div>
    
    <div class="clearFix"><!--x--></div>
    </div>
    <!--grid_3-->
    
    <?php endwhile; endif; ?>
    
    <div id="grid_3">
    
    Contact area
    
    <div class="clearFix"><!--x--></div>
    </div>
    <!--grid_3-->
    
    <?php get_footer(); ?>

    Any ideas, why it doesn’t seem to be printing the first page, it doesn’t even load the div, it just skips to the last col?

    Thanks 🙂

Viewing 1 replies (of 1 total)
  • Thread Starter jezthomp

    (@jezthomp)

    Any ideas, i’m scratching my head to why?

    All other posts load fine into the first one, i dont understand when the others appear fine.

    Is there something in the php telling it not to print the first post?

    🙁

Viewing 1 replies (of 1 total)

The topic ‘Multiple Loops, missing first post, showing rest?’ is closed to new replies.