Can I start from second post?
-
Hi.
I fetched the latest post from category and I want to also display 3 more latest posts from that category underneath the main one (news style) .
I have duplicated the “<?php while (have_posts()) : the_post(); ?>”
but it displays also the main post that I already fetched.I know there is a way to display main post from category and then a list of latest from that category but without the first one.
here is the code I used (i am not a programmer, just used common sense, But I feel it’s not the best solution for this)
<?php $display_categories = array(188,189,190,191); $i = 1; // החלף את מספרי הקטגוריות foreach ($display_categories as $category) { ?> <div class="headerone"> <?php query_posts("showposts=1&cat=$category")?> <h4><span><a href="<?php echo get_category_link($category);?>"><?php single_cat_title(); ?></a></span></h4> <a href="<?php echo get_category_link($category);?>"><?php echo category_description($category); ?></a> <?php while (have_posts()) : the_post(); ?> <div class="clearfloat" style="margin-bottom:10px;"> <a href="<?php the_permalink() ?>" rel="bookmark" title="קישור קבוע אל <?php the_title(); ?>"> <?php the_post_thumbnail( 'category-thumbnail' ); ?></a> <div class="info"><a href="<?php the_permalink() ?>" rel="bookmark" class="title"><?php the_title(); ?></a> <div class="excerpt"> <?php $excerpt = get_the_excerpt(); echo string_limit_words($excerpt,10); ?> </div> </div> </div> <?php endwhile; ?> <?php query_posts("showposts=3&cat=$category")?> <?php while (have_posts()) : the_post(); ?> <div class="clearfloat"> <a href="<?php the_permalink() ?>" rel="bookmark" title="קישור קבוע אל <?php the_title(); ?>"></a> <div class="info"><a href="<?php the_permalink() ?>" rel="bookmark" class="title"><?php the_title(); ?></a> </div> </div> <?php endwhile; ?> </div> <?php $i++; ?> <?php } ?> </div> <?php } ?>
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
The topic ‘Can I start from second post?’ is closed to new replies.