Excluding the First Post
-
On my main page: https://embedded411.com
I call our the “Latest Story” then list the 6 most recent stories below it. I do not want the Latest Story to be duplicated. I believe I have to run a query because I call for different fields. For example, the Latest Story calls for a custom image field, while stories 2-7 do not.
Can someone please tell me what’s wrong with my code? How do I eliminate the duplication of the latest story?
Latest Story
<?php query_posts('showposts=1'); ?> <?php while (have_posts()) : the_post(); ?> <a href="<?php the_permalink(); ?>"><img src="<?php $key="image"; echo get_post_meta($post->ID, $key, true); ?>" border="0" /></a> <div id="topstory"> <h4><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h4> <?php the_excerpt(); ?> <span class="comments"><?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?></span> <?php endwhile; ?>
Following stories, 2-7 most recent:
<?php $my_query = new WP_Query('showposts=6'); if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post(); if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?> <h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <span class="date"><?php the_time('j M') ?></span><br /> <span class="catname">Posted in: <?php the_category(', ') ?></span></h4> <?php the_excerpt(); ?> <span class="comments"><?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?></span><br /> <br /> <?php endwhile; endif; ?>
Viewing 12 replies - 1 through 12 (of 12 total)
Viewing 12 replies - 1 through 12 (of 12 total)
- The topic ‘Excluding the First Post’ is closed to new replies.