• Resolved canutedechou

    (@canutedechou)


    i have a blog wich shows post with featured image, and it show it in 4 columns. the last post from that column is the 4th, and i apply a php code so i can put a different style on that column to create a good align

    the code is:

    <div class="work-post <?php if ($count == 4) { echo 'last'; $count2=0; } ?>">

    my question is
    how can i make that it detect also the 8th post
    i know the detection is here $count == 4 but don know php
    thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • stvwlf

    (@stvwlf)

    Not sure what you are doing with $count2.
    This might work if count = 4 or count = 8

    <div class="work-post <?php if ($count == 4 || $count == 8) { echo 'last'; $count2=0; } ?>">

    Michael

    (@alchymyth)

    or to detect every fourth post:

    <div class="work-post <?php if ($count%4 == 0) { echo 'last'; $count2=0; } ?>">

    % modulus operator:
    get the remainder of a division

    Thread Starter canutedechou

    (@canutedechou)

    thanks a lot stvwlf and alchymyth!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Detect 4 and 8th post published’ is closed to new replies.