• Resolved Suika

    (@suikalum)


    Hi,

    Is there a way I can tell if the post is odd/even using the repeater template?

    I’m thinking of hooking a counter variable before the plugin loops, but can’t find it on the files and I’m afraid it will just be overwritten on update.

    Another is I tried using <?php if ($wp-query->current_post % 2 == 0): ?> but no luck too.

    Does anyone have a solution for this? Thank you

    https://wordpress.org/plugins/ajax-load-more/

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

    (@suikalum)

    Nevermind I used this code

    <div><?php if ($alm_current == 1) {
    	echo "odd";
    }
    else {
    	echo "even";
    } ?></div>

    actually the combination of the 2 codes works best

    <div class="<?php if ($alm_current%2 == 0) { echo "even"; } else { echo "odd"; } ?>"></div>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get odd/even data on repeater template’ is closed to new replies.