Controls
Select
Select control creates a set of choices to select from and used to store a string value for the block. See examples below to use this control.
To add select options you need to fill the Choices
setting:
Control Settings
- Choices – options set for control to select from
- Allow Null – allow to reset value
- Multiple – possibility to select the multiple values
- Output Format – specifies the returned value format. Choose from
Value
,Label
orBoth (Array)
.
Usage
PHP
<p>
<?php echo $attributes['control_name']; ?>
</p>
PHP + Multiple
<?php foreach( $attributes['control_name'] as $inner ): ?>
<p>
<?php echo $inner; ?>
</p>
<?php endforeach; ?>
PHP with Output Format as Array
<p>
<?php echo $attributes['control_name']['label']; ?>
</p>
<p>
<?php echo $attributes['control_name']['value']; ?>
</p>
Handlebars
<p>
{{control_name}}
</p>
Handlebars + Multiple
{{#each control_name}}
<p>
{{this}}
</p>
{{/each}}
Handlebars with Output Format as Array
<p>
{{control_name.label}}
</p>
<p>
{{control_name.value}}
</p>
Post Meta
<p>
<?php echo get_lzb_meta( 'control_meta_name' ); ?>
</p>