Skip to content
Controls

Text

Text control provides a simple input field for single-line text content. It's perfect for headings, titles, or any short text input.

Text Control

Control Settings

  • Placeholder - Text shown when the field is empty
  • Characters Limit - Maximum number of characters allowed (leave blank for no limit)

Usage Examples

Basic Output

PHP
<h2 class="title">
    <?php echo esc_html( $attributes['control_name'] ); ?>
</h2>
Handlebars
<h2 class="title">
  {{control_name}}
</h2>

With HTML Attributes

PHP
<a href="#" title="<?php echo esc_attr( $attributes['control_name'] ); ?>">
    Link with title
</a>

Post Meta

Post Meta
<?php
$text = get_lzb_meta( 'control_meta_name' );
if ( $text ) {
    echo '<h2 class="title">' . esc_html( $text ) . '</h2>';
}
?>

Always use proper escaping functions:

  • esc_html() for regular text output
  • esc_attr() for HTML attributes

Was this article helpful?