WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Category last post

[Resolved] Category last post

  • 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

Viewing 1 replies (of 1 total)
  • 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 } ?>

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Category last post’ is closed to new replies.
Skip to toolbar