Support

Account

Home Forums Add-ons Repeater Field Every row in an own DIV

Solved

Every row in an own DIV

  • Hello, i hope you can help me with the following problem:

    I have a Team-Member-Site with the fields
    name_des_anwalts
    bild_des_anwalts
    schwerpunkte_des_anwalts

    These fields should display on the website in a box, so I have put a div around it (box_anwaelte):

    <div class="box_anwaelte">
        	<?php
                    if (have_rows("anwaelte")):
                        while (have_rows("anwaelte")): the_row();
                        // vars
                        $employeeName = get_sub_field("name_des_anwalts");
    					$employeeImage = get_sub_field("bild_des_anwalts");
                        $employeeContent = get_sub_field("schwerpunkte_des_anwalts"); ?>
                        <h2><?php echo $employeeName; ?></h2>
                       	<img class="img_anwaelte" alt="Bild von <?php echo $employeeName; ?>" src="<?php echo $employeeImage; ?>">
                        <br>
    					<?php echo $employeeContent; 
                        endwhile;
                    endif;
                ?>
                
                <?php
    			$image = get_field('bild_des_anwalts');
    			if( !empty($image) ): ?>
    			<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
    		<?php endif; ?>
        </div>

    But when I have two rows they are displayed in one (the same) box. How can I get it that every row is in its own div-box?

    Thanks in advance!

  • 
    <?php
      if (have_rows("anwaelte")):
        while (have_rows("anwaelte")): the_row();
          ?>
            <div class="box_anwaelte">
              <?php 
                // vars
                $employeeName = get_sub_field("name_des_anwalts");
                $employeeImage = get_sub_field("bild_des_anwalts");
                $employeeContent = get_sub_field("schwerpunkte_des_anwalts"); 
              ?>
              <h2><?php echo $employeeName; ?></h2>
              <img class="img_anwaelte" alt="Bild von <?php 
                  echo $employeeName; ?>" src="<?php echo $employeeImage; ?>">
              <br>
              <?php echo $employeeContent; ?>
            </div>
          <?php 
        endwhile;
      endif;
    ?>
    
  • Wow, that was fast! Thank you so much! It seems like I had a blind spot!

  • I must have happened to look at the new topics at just the right time.

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Every row in an own DIV’ is closed to new replies.