-
Notifications
You must be signed in to change notification settings - Fork 124
Wysiwyg field
ajitbohra edited this page Dec 1, 2014
·
19 revisions
A WYSIWYG editor field.
- id (string) (required)
- name (string) (required) Field display name. Used as field label.
- type 'wysiwyg' (string) (required)
- options (array) (optional) wp_editor settings. See WordPress codex.
array(
'id' => 'example-field-wysiwyg',
'name' => 'A WYSIWYG editor field',
'type' => 'wysiwyg',
'options' => array(
'textarea_rows' => 5
)
),
The data is stored using double line breaks instead of paragraph tags - similar to the way WordPress handles the post content. When outputting the data, typically you would want to convert these line breaks to paragraph tags. Use the WordPress function wpautop
to do this.
// Note 3rd param is false to retrieve all meta entries with the same key (Default is false)
$field_data = get_post_meta( get_the_id(), 'example-field-wysiwyg', false );
echo wpautop( $content );
- Setup/Install Custom Meta Boxes
- Creating a custom meta box
- Displaying Field Data
- Optional Generic Field Args
- Repeatable Fields
General
- Text Field
- Small Text Field
- Number Field
- URL Field
- Textarea Field
- Code Field
- Select Field
- Checkbox Input Field
- Radio Input Field
Date & Time
WordPress
Media
Utilities