• [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 ]

    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.