1. Home
  2. Docs
  3. WordPress Studio Framework
  4. Framework Fields
  5. Text Field

Text Field

Arguments

NameTypeDefaultDescription
idstring A unique ID. This ID will be used to get the value
typestringtextType of the field
titlestring Title of the field
defaultstring Default value from database, if the option doesn’t exist
subtitlestring Subtitle to display below the title
descstring Description to display after the field
helpstring Text to display on right-corner (as hover/popup) the field
classstring Extra CSS classes (space separated) to append to the field
beforestring Content to display before the field
afterstring Content to display after the field
dependencyarray Define field visibility depending on other field value
attributesarray Extra HTML attributes to append to the field
sanitizestring Callback function for sanitizing value
validatestring Callback function for validating value
EXTRAS   
placeholderstring The placeholder to be displayed when nothing is typed

Text Field Example

array(
  'id' => 'example-text',
  'type' => 'text',
  'title' => 'Example Text',
  'default' => 'Hello World!',
),

Text Field Usage

$my_options = get_option( 'custom_framework' ); //prefix of framework
echo $my_options['example-text'];  //id of field
Was this article helpful to you? Yes No

How can we help?