Exemple #1
0
 /**
  * Get a rendered metabox field
  * @param string $name
  * @param array $field
  */
 public function getRenderMetaBoxField($name, $field = null)
 {
     $is_wysiwyg = $field['type'] === 'textarea' && array_key_exists('class', $field) && preg_match('/wysiwyg/', $field['class']);
     if ($is_wysiwyg) {
         // Showing the editor on the quick add form will break the WordPress admin UI
         // So we'll only allow the WYSIWYG to appear on the edit screen
         if (array_key_exists('tag_ID', $_GET)) {
             $value = array_key_exists('value', $field) ? $field['value'] : null;
             ob_start();
             wp_editor($value, $name);
             return ob_get_clean();
         }
         return '<p>Add this record, then edit the record to see the WYSIWYG editor.</p>';
     }
     return parent::getRenderMetaBoxField($name, $field);
 }