Support » Plugin: Block Lab » Select Labels

  • Resolved Elliot Toman


    I may be missing something in the documentation, but how can I output the label of a select rather than its value?

    For example, if the select option is
    option_1 : Option One

    …I want to output “Option One,” but block_field( ‘select_name’ ) will only output “option_1.”


Viewing 1 replies (of 1 total)
  • Plugin Author Luke Carbis


    Hey @asubtleweb . Thanks for checking out Block Lab.

    The block_field() and block_value() functions only return the _value_ of a field, which is why they don’t help with the label.

    Instead, you can access the label via the block_field_config() function, which returns all of the settings you’ve assigned to that field.

    $select = block_field_config( 'select_name' );
    if ( isset( $select['options'] ) ) {
    	foreach( $select['options'] as $option ) {
    		echo '<li>' . $option['label'] . '</li>';

    Documentation is here:

    Hope that helps!

Viewing 1 replies (of 1 total)
  • The topic ‘Select Labels’ is closed to new replies.