Support

Account

Home Forums Add-ons Repeater Field Attachment Size with Repeater Field issue Reply To: Attachment Size with Repeater Field issue

  • Something like this.

    <?php if( have_rows('repeater_field_name') ): ?>
     	<?php while ( have_rows('repeater_field_name') ) : the_row(); ?>
     	
     	<?php
     		$attachment_id = get_sub_field('file_upload');
    		$url = wp_get_attachment_url( $attachment_id );
    		$title = get_the_title( $attachment_id );
    		
    		// part where to get the filesize
    		$filesize = filesize( get_attached_file( $attachment_id ) );
    		$filesize = size_format($filesize, 2);
     	?>
    
      	<!-- display a sub field value -->
      	<div class="item-upload">
        	<?php the_sub_field('file_upload'); ?> (<?php echo $filesize; ?>)
      	</div>
     
    <?php endwhile; else : ?>
    <?php endif; ?>