Add in editor for fields

This commit is contained in:
Jay Wood
2016-09-30 13:43:13 -04:00
parent 05a785cfe0
commit e2b2959fea
2 changed files with 42 additions and 16 deletions

View File

@ -347,6 +347,12 @@ class CWV2_Admin {
'name' => __( 'Dialog Message', 'content-warning-v2' ),
'desc' => __( 'A message shown to your visitor.', 'content-warning-v2' ),
'type' => 'editor',
'options' => array(
'textarea_rows' => 10,
),
'options' => array(
'textarea_rows' => 10,
),
),
array(
'id' => 'exit_txt',
@ -404,6 +410,9 @@ class CWV2_Admin {
'name' => __( 'Denial Message', 'content-warning-v2' ),
'desc' => __( '', 'content-warning-v2' ),
'type' => 'editor',
'options' => array(
'textarea_rows' => 10,
),
),
array(
'id' => 'bg_image',

View File

@ -272,6 +272,23 @@ class CWV2_Settings {
public function editor( $args = array() ) {
$args = $this->get_default_args( $args );
$field_id = $args['id'];
$description = $args['desc'];
$default = empty( $args['default'] ) ? '' : $args['default'];
$options = empty( $args['options'] ) ? array() : $args['options'];
if ( empty( $field_id ) ) {
return;
}
$option_value = get_option( $field_id, $field_id, $default );
wp_editor( $option_value, $field_id, $options );
if ( ! empty( $description ) ) {
?><p class="description"><?php echo $description; ?></p><?php
}
}
/**