block_sub_value()

Description

The block_sub_value() function is just a really simple helper function that calls block_sub_field with its $echo parameter set to false. The result is a returned value of the field, without any output.

block_sub_value( $name )

Parameters

  • $name¬†(string)¬†(Required)¬†The repeater field name.

Usage

if ( block_rows( 'my-repeater' ) ) :
  while ( block_rows( 'my-repeater' ) ) :
    block_row( 'my-repeater' );

    block_sub_field( 'my-text-field' );

    $foo = block_sub_value( 'my-checkbox' );
    if ( $foo ) {
      // Do something.  
    }
  endwhile;
endif;