WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Category last post (2 posts)

  1. magtzedong
    Member
    Posted 6 years ago #

    Hi there.

    Just would want to know how to diplay the n posts of a category except the last one.... 'cause I'd like to display the last one post in a different way...

    Thanks in advance!
    Best regards

  2. magtzedong
    Member
    Posted 6 years ago #

    Resolved!

    I've done it with a count variable.
    Put this to a point directly before your loop starts:

    <?php $i = 0; ?>

    ... and the following lines inside of your loop...

    <?php if ($i++ == 0) { ?>
    <!-- first post of the category -->
    <?php } else { ?>
    <!-- the other posts -->
    <?php } ?>

Topic Closed

This topic has been closed to new replies.

About this Topic