Title: Dealing with Loop
Last modified: August 20, 2016

---

# Dealing with Loop

 *  [Daemonian](https://wordpress.org/support/users/daemonian/)
 * (@daemonian)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/dealing-with-loop/)
 * _[please use the code button to mark the code in your post – and use the pastebin
   for any code longer than 10 lines – see [http://codex.wordpress.org/Forum\_Welcome#Posting\_Code](http://codex.wordpress.org/Forum_Welcome#Posting_Code)]_
 * Hi everyone!
    After reading lot of posts and solutions, I haven’t found the one
   which fits well to my “trouble”. Here is: I want to have the three lasts post
   of a category (Titular) in my home, but this way: <div id=”num1″> LAST POST (
   i.e. post number 50) </div>
 * <div id=”num2″>
    PENULTIMATE POST (i.e. post number 49) PENULTIMATE’S PREVIOUS
   POST (i.e. post number 48) </div>
 * I’ve been reading a lot in this posts but I don’t have what I’m doing wrong:
   
   For the first div: <div id=”num1″> <?php $do_not_duplicate[] = $post->ID; ?> 
   <h2 id=”post-<?php the_ID(); ?>”> <?php the_title(); ?></h2> <p>“>Ver artículo
   </p> </div>
 * And for the second one:
    <div id=”num2″> <?php query_posts(array (‘posts_per_page’
   => 3, ‘post__not_in’ => $do_not_duplicate) ); if (have_posts()) : while (have_posts()):
   the_post();?> <h3 id=”post-<?php the_ID(); ?>”> <?php the_title(); ?></h3> <?
   php the_excerpt(); ?> <?php endwhile; ?> </div>
 * And I have a first area with the last post’s title and “Ver artículo”, and a 
   second area with the three last post. This last issue is wrong, becasue I want
   the two previous posts to last one.
 * Please help me! I’m getting mad 🙁
 * Thanks in advance

The topic ‘Dealing with Loop’ is closed to new replies.

## Tags

 * [loop](https://wordpress.org/support/topic-tag/loop/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [Daemonian](https://wordpress.org/support/users/daemonian/)
 * Last activity: [14 years, 5 months ago](https://wordpress.org/support/topic/dealing-with-loop/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
