Helper functions that provide context about the current row during iteration.
get_row()
Returns the full current row as an associative array.
Returns:array — all sub-field values for the current row.
php
if ( have_rows( 'slides' ) ) :
while ( have_rows( 'slides' ) ) : the_row();
$row = get_row();
// $row = ['title' => 'Slide 1', 'image' => 'url', ...]
endwhile;
endif;get_row_index()
Returns the 1-based index of the current row.
Returns:int — 1-indexed row number (1, 2, 3, …).
php
if ( have_rows( 'features' ) ) :
while ( have_rows( 'features' ) ) : the_row();
$index = get_row_index();
$delay = ( $index - 1 ) * 100;
echo '<div class="feature feature-' . $index . '" style="animation-delay: ' . $delay . 'ms;">';
echo '<span class="number">' . str_pad( $index, 2, '0', STR_PAD_LEFT ) . '</span>';
the_sub_field( 'title' );
echo '</div>';
endwhile;
endif;get_row_layout()
Returns the layout name for the current row in a Flexible Content field.
Returns:string — layout slug (e.g., 'hero', 'text_block', 'gallery').
php
if ( have_rows( 'page_sections' ) ) :
while ( have_rows( 'page_sections' ) ) : the_row();
$layout = get_row_layout(); // e.g., 'hero', 'text_block', 'gallery'
get_template_part( 'sections/section', $layout );
endwhile;
endif;Full Compatibility Function Reference
| Function | Signature | Returns |
|---|---|---|
get_field() | ( $selector, $post_id = false ) | mixed|null |
the_field() | ( $selector, $post_id = false ) | void |
get_fields() | ( $post_id = false ) | array |
get_field_object() | ( $selector, $post_id = false ) | array|false |
get_field_objects() | ( $post_id = false ) | array |
update_field() | ( $selector, $value, $post_id = false ) | int |
delete_field() | ( $selector, $post_id = false ) | bool |
have_rows() | ( $selector, $post_id = false ) | bool |
the_row() | () | void |
get_row() | () | array |
get_row_index() | () | int (1-based) |
get_row_layout() | () | string |
get_sub_field() | ( $selector ) | mixed |
the_sub_field() | ( $selector ) | void |
get_sub_field_object() | ( $selector ) | array|false |
acf_register_block_type() | ( $config ) | void |
fieldforge_register_block_type() | ( $config ) | void |
fieldforge_add_options_page() | ( $args ) | void |
fieldforge_preload() | ( $post_ids ) | void |
—