Content Editor
The content-editor
lets you add a Content Editor Field.

Parameters
Here are the parameters in adding content-editor
.
a unique slug-like string to use as an id and also as index in saving data in database.
the label of the field.
the description of the field and display under the label.
the section where the field will be displayed.
the default value of the field.
determines the order of fields in section.
add a media uploader button.
allowing to add controls in toolbars.
Note: here are the list of toolbars available [ 'bold', 'italic', 'strikethrough', 'bullist', 'numlist', 'blockquote', 'hr', 'alignleft', 'aligncenter', 'alignright', 'link', 'unlink', 'wp_more', 'spellchecker', 'fullscreen', 'wp_adv', 'formatselect', 'underline', 'alignjustify', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', 'wp_help' ]
Example
Yano::field( 'content-editor', [
'id' => 'editor1',
'label' => 'Write Your Content',
'description' => 'Description Here.',
'section' => 'section_id',
'priority' => 1,
] );
Example with default
value! note: default value can only be supplied of string
or html
.
Yano::field( 'content-editor', [
'id' => 'editor1',
'label' => 'Write Your Content',
'description' => 'Description Here.',
'section' => 'section_id',
'default' => 'Hello World',
'priority' => 1,
] );
Example with uploader
! note: uploader can be supplied only in boolean
.
Yano::field( 'content-editor', [
'id' => 'editor1',
'label' => 'Write Your Content',
'description' => 'Description Here.',
'section' => 'section_id',
'default' => 'Hello World',
'priority' => 1,
'uploader' => true
] );
Example with toolbars
! here are the list of toolbars available bold
, italic
, strikethrough
, bullist
, numlist
, blockquote
, hr
, alignleft
, aligncenter
, alignright
, link
, unlink
, wp_more
, spellchecker
, fullscreen
, wp_adv
, formatselect
, underline
, alignjustify
, forecolor
, pastetext
, removeformat
, charmap
, outdent
, indent
, undo
, redo
, wp_help
.
Yano::field( 'content-editor', [
'id' => 'editor1',
'label' => 'Write Your Content',
'description' => 'Description Here.',
'section' => 'section_id',
'default' => 'Hello World',
'priority' => 1,
'uploader' => true,
'toolbars' => [ 'bold', 'italic' ]
] );
Usage
The get_theme_mod()
function is recommended to retrieve data.
// Return a string
echo get_theme_mod('editor1');