• Hi there, does anyone knows hoy to alter class every two items, or use even and odd, both twice? Example:

    <article class="even"></article>
    <article class="even"></article>
    <article class="odd"></article>
    <article class="odd"></article>
    <article class="even"></article>
    <article class="even"></article>
    <article class="odd"></article>
    <article class="odd"></article>

    https://www.ads-software.com/plugins/posts/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter fetusz

    (@fetusz)

    i’ve just solve it, here the code:

    <?php $cuenta = 1+$wp_query->current_post % 6; ?>
    <article class="grid <?php if ($cuenta==3 || $cuenta==4){ echo 'rctngl'; } else { echo 'sqr'; } ?>">

    The result is this:

    <article class="grid sqr"></article>
    <article class="grid sqr"></article>
    <article class="grid rctngl"></article>
    <article class="grid rctngl"></article>
    <article class="grid sqr"></article>
    <article class="grid sqr"></article>

    and repeat…

    Thread Starter fetusz

    (@fetusz)

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Alter classes every two posts’ is closed to new replies.