Home Forums Front-end Issues Help – Repeater


Help – Repeater

  • Hello,

    I am trying to figure out how to change the colour of a wrapper when there is a block of 4 items in a row?

    Please see my code below:

    I am not sure where i am going wrong and would appreciate help here, please see attached a screenshot of what i am trying to achieve.

    for($i=1;$i<=4;$i++ ){
    $odd_even = $i%2;
    if($odd_even == ‘0’){
    $colors_class = “grey”;
    $colors_class = “teal”;


    <div class=”wrapper –small-blocks –<?php echo $colors_class; ?>” style=”margin:0; height: auto;”>
    <div class=”container”>
    <div class=”row”>
    <?php while( have_rows(‘small-blocks’) ): the_row(); $blocktitle = get_sub_field(‘block-title’); $blocktext = get_sub_field(‘block-text’); ?>
    <?php if( get_row_index() % 2 == 0 ) : ?>
    <div class=”col-lg-6″>
    <?php endif;?>
    <?php endwhile;?>

    <?php } //end loop ?>

    Kind regards

    Stuart Kirkland

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.