Support

Account

Home Forums Add-ons Repeater Field Removing an element from last row of repeater Reply To: Removing an element from last row of repeater

  • While you could just not display that <p> element you could put that in a div and then set a border on the div, for example:

    HTML

    
    <div class="project-section">
       <!-- your content here -->
    </div>
    

    CSS

    
     .items .project-section {
        border-top: 10px #000 solid;
      }
     .items .project-section:first-child {
        border-top: none;
      }
    

    or you can alter the loop the way you suggest by doing something like this:

    
    <span class="items">
        <?php if( have_rows('repeater_indevelopment', 14) ): ?>
            <?php 
              $rows = count(get_field('repeater_indevelopment'));
              $count = 0;
            ?>
    
    	<?php while( have_rows('repeater_indevelopment', 14) ): the_row();
    
            // vars
            $project = get_sub_field('project', 14);
    
            ?>
    
                <?php if ($project): ?>
    				<p class="projectname"><?php the_sub_field ('project', 14); ?>&nbsp;|&nbsp;<?php the_sub_field('medium', 14); ?></p>
                    <p class="projectstage"><?php the_sub_field ('status', 14); ?></p>
                    <?php 
                       $count++;
                       if ($count < $rows) {
                         ?><p class="devborder"></p><?php 
                       }
                    ?>
                    <br>
                <?php endif; ?>
    	<?php endwhile; ?>
    
        <?php endif; ?>
        <p class="project name" ><?php the_field('nocontent', 14) ?></p>
    </span>