Controls
Color Picker
Color picker control is used to store a string with color hex
or rgba
values for the block. This control displays the predefined color palette with the possibility to select a custom color. See examples below to use this control.
Control Settings
- Alongside Text – displays text alongside the checkbox/toggle
- Alpha Channel – allows to set semi-transparent colors with rgba
- Color Palette – display color palette with predefined colors
- Output Format – specifies the returned value format. Choose from
Color
orArray (Color + Slug)
Usage
PHP
<p style="color: <?php echo esc_attr( $attributes['control_name'] ); ?>">
Example text with custom color added using inline css.
</p>
PHP with Output Format as Array
<p style="color: <?php echo esc_attr( $attributes['control_name']['color'] ); ?>">
Example text with custom color added using inline css.
</p>
<p class="color-<?php echo esc_attr( $attributes['control_name']['slug'] ); ?>">
Example text with custom color added using classname.
</p>
Handlebars
<p>{{control_name}}</p>
Handlebars with Output Format as Array
<p>
{{control_name.color}}
</p>
<p>
{{control_name.slug}}
</p>
Post Meta
<p>
<?php echo get_lzb_meta( 'control_meta_name' ); ?>
</p>