Text

The text lets you add a text field.

Text

Parameters

Here are the parameters in adding text.

id
string | required

a unique slug-like string to use as an id and also as index in saving data in database.

label
string | optional

the label of the field.

description
string | optional

the description of the field and display under the label.

section
string | requiredl

the section where the field will be displayed.

default
string | optional

the default value of the field.

priority
integer | optional

determines the order of fields in section.

placeholder
string | optional

display placeholder in field.

Example


Yano::field( 'text', [
   'id'          => 'textdb1',
   'label'       => 'Short Story',
   'description' => 'Write short story in here.',
   'section'     => 'section_id',
   'priority'    => 1,
   'placeholder' => 'Your story in here...'
] );

Example with default value.


Yano::field( 'text', [
   'id'          => 'textdb1',
   'label'       => 'Short Story',
   'description' => 'Write short story in here.',
   'section'     => 'section_id',
   'default'     => 'hello world',
   'priority'    => 1,
   'placeholder' => 'Your story in here...'
] );

Usage

The get_theme_mod() function is recommended to retrieve data.


// Return a string
echo get_theme_mod('textdb1');