get_row()
Gets an array (in name => value format) for the current row of a have_rows() loop.
Comparison with the_row()
The function returns the same data as the_row(), but it does not include row processing in the have_rows() loop.
No Hooks.
Returns
null. An array in name => value format.
Usage
get_row( $format_value );
- $format_value(true/false)
- Apply formatting logic.
Default: true
Examples
#1 Load and display the current row values
<?php if( have_rows('slides') ): ?>
<?php
while( have_rows('slides') ): the_row();
// Get all values for this row.
$row = get_row();
// Check for image value.
if( $row['image'] ){
?>
<img src="<?php echo $row['image']; ?>" />
<p><?php echo $row['caption']; ?></p>
<?php
}
?>
<?php endwhile; ?>
<?php endif; ?>