WordPress.org

Ready to get started?Download WordPress

Forums

Getting a the Post Position (php funct?) (2 posts)

  1. chocks
    Member
    Posted 5 years ago #

    Hi guys,

    I was wondering if you could setup a function that tells you which is the 'position of the post' if it's the first to be displayed (the last one on the top) or if it's a multiple of 6.

    The reason is that I've a div with a background img which should be repeated in 4 out of 5 posts that each page displays: So when is page #2 it should be:
    Post #6 (the first to be displayed, on the top): no bg img.
    Post #7 (older): bg img
    ..
    Post #11: bg img.

    And I want the sequence to be repeated.

    Is there any function that says something like:

    php if (the_post_position() % 6 == 0 ) {echo('class=top')}

    I don't know how to code, but I've been sorting out pretty well.

    Cheers,

    Chocks.-

    PS. Post #1 is render by a unique query, so there's no issue there neither on posts #2 to #5 because they use -of course- another query (with an offset=1).

  2. chocks
    Member
    Posted 5 years ago #

    Anyone please?

Topic Closed

This topic has been closed to new replies.

About this Topic