8. Referencia de Funciones de Fila | Field Forge - Campos personalizados, diseñados para la velocidad
Descargar Iniciar sesión

8. Referencia de Funciones de Fila

Funciones auxiliares que proporcionan contexto sobre la fila actual durante la iteración.

get_row()

Devuelve la fila completa actual como un array asociativo.

Devuelve: array — todos los valores de subcampo para la fila actual.
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()

Devuelve el índice basado en 1 de la fila actual.

Devuelve: int — número de fila indexado en 1 (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()

Devuelve el nombre del diseño para la fila actual en un campo de Contenido Flexible.

Devuelve: string — slug del diseño (por ejemplo, '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;

Referencia Completa de Funciones de Compatibilidad

FunciónFirmaDevuelve
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 (basado en 1)
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

Asistente de IA de Forge En línea

¡Hola! Soy el asistente de IA de Field Forge. Pregúntame lo que quieras sobre el plugin — configuración, funciones, resolución de problemas o desarrollo.

Ahora mismo
Con la tecnología de Forge AI · Explorar documentación