# Loop over a repeater

Source: https://uglydev.com/docs/how-do-i-print-values/loop-over-a-repeater/
Updated: 19 November 2026

```php
<ul>
	<?php foreach ( ugly_rows( 'team' ) as $person ) : ?>
		<li>
			<?php $person->show( 'name' ); ?>
			<?php if ( $person->has( 'role' ) ) : ?>
				<em><?php $person->show( 'role' ); ?></em>
			<?php endif; ?>
		</li>
	<?php endforeach; ?>
</ul>
```

`ugly_rows()` always gives a list, empty when there is nothing, so no `if` is needed around the loop. A row is a **variable**: pass it to `get_template_part( 'parts/person', null, array( 'person' => $person ) )`.
