本文整理汇总了PHP中wp_editor函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_editor函数的具体用法?PHP wp_editor怎么用?PHP wp_editor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_editor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ac_user_bio_visual_editor
function ac_user_bio_visual_editor($user)
{
// Contributor level user or higher required
if (!current_user_can('edit_posts')) {
return;
}
?>
<table class="form-table">
<tr>
<th><label for="description"><?php
_e('Biographical Info', 'alleycat');
?>
</label></th>
<td>
<?php
$description = get_user_meta($user->ID, 'description', true);
wp_editor($description, 'description');
?>
<p class="description"><?php
_e('Share a little biographical information to fill out your profile. This may be shown publicly.', 'alleycat');
?>
</p>
</td>
</tr>
</table>
<?php
}
示例2: message_editor
/**
* @param $default_message
*/
function message_editor($default_message)
{
$settings = LP()->settings;
$content = stripslashes($settings->get($this->section['id'] . '.message', $default_message));
$editor_id = 'email_message';
wp_editor(stripslashes($content), $editor_id, array('textarea_rows' => 10, 'wpautop' => false, 'textarea_name' => "lpr_settings[{$this->id}][message]"));
}
示例3: showFields
public static function showFields($mb)
{
$adminTemplatesFolderLocation = dirname(__FILE__) . '/admin_views/';
Mustache_Autoloader::register();
$template = new Mustache_Engine(array('loader' => new Mustache_Loader_FilesystemLoader($adminTemplatesFolderLocation), 'partials_loader' => new Mustache_Loader_FilesystemLoader($adminTemplatesFolderLocation)));
$fields = $mb->fields;
foreach ($fields as $field) {
if (empty($field['name']) || empty($field['fieldType']) || empty($field['labelTitle'])) {
continue;
}
$mb->the_field($field['name']);
if ($field['fieldType'] == 'textarea') {
wp_editor(html_entity_decode($mb->get_the_value()), $mb->get_the_name(), array('wpautop' => true, 'media_buttons' => false, 'textarea_rows' => get_option('default_post_edit_rows', 10), 'tabindex' => '', 'editor_css' => '', 'editor_class' => '', 'teeny' => true, 'dfw' => false, 'tinymce' => false, 'quicktags' => true));
} else {
switch ($field['fieldType']) {
case 'imageUploader':
$fieldHtml = self::getImageUploaderHtml($mb, $template);
break;
default:
$fieldHtml = $template->render('text_field', array('theValue' => $mb->get_the_value(), 'theName' => $mb->get_the_name()));
}
echo $template->render('field_container', array('labelText' => $field['labelTitle'], 'fieldHTML' => $fieldHtml));
}
}
}
示例4: render
public function render()
{
require $this->templateHandler->getView('field/wrapper-start');
$args = array('textarea_name' => $this->getConfigData('name'), 'teeny' => true);
wp_editor($this->getFieldValue(), $this->getConfigData('name'), $args);
require $this->templateHandler->getView('field/wrapper-end');
}
示例5: render
/**
* Field Render Function.
*
* Takes the vars and outputs the HTML for the field in the settings
*
* @since 1.0.0
* @access public
* @return void
*/
public function render()
{
// Setup up default editor_options
$defaults = array('textarea_name' => $this->args['opt_name'] . '[' . $this->field['id'] . ']', 'editor_class' => $this->field['class'], 'textarea_rows' => 10, 'teeny' => true);
$this->field['editor_options'] = wp_parse_args($this->field['editor_options'], $defaults);
wp_editor($this->value, $this->field['id'], $this->field['editor_options']);
}
示例6: wpcf_admin_post_meta_box
/**
* Renders meta box content.
*
* @param type $post
* @param type $group
*/
function wpcf_admin_post_meta_box($post, $group)
{
if (!empty($group['args']['fields'])) {
// Display description
if (!empty($group['args']['description'])) {
echo '<div class="wpcf-meta-box-description">' . wpautop(wpcf_translate('group ' . $group['args']['id'] . ' description', $group['args']['description'])) . '</div>';
}
foreach ($group['args']['fields'] as $field_slug => $field) {
// Render form elements
if (wpcf_compare_wp_version() && $field['#type'] == 'wysiwyg') {
// Especially for WYSIWYG
unset($field['#before'], $field['#after']);
echo '<div class="wpcf-wysiwyg">';
echo '<div id="wpcf-textarea-textarea-wrapper" class="form-item form-item-textarea wpcf-form-item wpcf-form-item-textarea">
<label class="wpcf-form-label wpcf-form-textarea-label">' . $field['#title'] . '</label>';
echo '<div class="description wpcf-form-description wpcf-form-description-textarea description-textarea">
' . wpautop($field['#description']) . '</div>';
wp_editor($field['#value'], $field['#id'], $field['#editor_settings']);
$field['slug'] = str_replace(WPCF_META_PREFIX . 'wysiwyg-', '', $field_slug);
$field['type'] = 'wysiwyg';
echo '</div></div><br /><br />';
} else {
if ($field['#type'] == 'wysiwyg') {
$field['#type'] = 'textarea';
}
echo wpcf_form_simple(array($field['#id'] => $field));
}
do_action('wpcf_fields_' . $field_slug . '_meta_box_form', $field);
if (isset($field['wpcf-type'])) {
// May be ignored
do_action('wpcf_fields_' . $field['wpcf-type'] . '_meta_box_form', $field);
}
}
}
}
示例7: admin_enqueue_scripts
/**
* Queue assets for taxonomy screens.
*
* @since 1.5.0
*/
public function admin_enqueue_scripts()
{
$pagenow = $GLOBALS['pagenow'];
if (!(self::is_term_edit($pagenow) || self::is_term_overview($pagenow))) {
return;
}
$asset_manager = new WPSEO_Admin_Asset_Manager();
$asset_manager->enqueue_style('scoring');
$tag_id = filter_input(INPUT_GET, 'tag_ID');
if (self::is_term_edit($pagenow) && !empty($tag_id)) {
wp_enqueue_media();
// Enqueue files needed for upload functionality.
$asset_manager->enqueue_style('metabox-css');
$asset_manager->enqueue_style('snippet');
$asset_manager->enqueue_style('scoring');
wp_editor('', 'description');
$asset_manager->enqueue_script('metabox');
$asset_manager->enqueue_script('term-scraper');
wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'term-scraper', 'wpseoTermScraperL10n', $this->localize_term_scraper_script());
wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'replacevar-plugin', 'wpseoReplaceVarsL10n', $this->localize_replace_vars_script());
wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'metabox', 'wpseoSelect2Locale', substr(get_locale(), 0, 2));
$asset_manager->enqueue_script('admin-media');
wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'admin-media', 'wpseoMediaL10n', array('choose_image' => __('Use Image', 'wordpress-seo')));
}
}
示例8: render_content
public function render_content($vals = null)
{
do_action(self::$type_slug . '_before_render_content', $this);
if ($vals != null) {
$this->field = (object) $vals;
}
$value = $vals != null ? $this->field->saved : $this->get_value();
$section = isset($this->page->section) && $this->page->section != '' ? 'data-section="' . $this->page->section . '"' : '';
ob_start();
wp_editor(htmlspecialchars_decode(is_string($value) ? $value : ''), $this->field->alias, array('data-section' => isset($this->page->section) ? $this->page->section : ''));
$this->link();
$html = ob_get_contents();
ob_end_clean();
echo $html;
?>
<script type="text/javascript">
jQuery(document).ready(function($){
$('textarea.wp-editor-area').addClass('custom-data-type');
$('textarea.wp-editor-area').attr('data-section', '<?php
echo isset($this->page->section) ? $this->page->section : '';
?>
' );
$('textarea.wp-editor-area').attr('data-type', 'texteditor-type' );
})
</script>
<?php
do_action(self::$type_slug . '_after_render_content', $this);
}
示例9: wma_movie_details_render
/**
* Renders the meta_box created at wma_add_movies_metaboxes()
*/
function wma_movie_details_render()
{
global $post;
wp_nonce_field('wma_movie_details_save', 'wma_movie_details_nonce');
$poster_url = sanitize_text_field(get_post_meta($post->ID, '_wma_poster_url', true));
$rating = absint(get_post_meta($post->ID, '_wma_rating', true));
$year = absint(get_post_meta($post->ID, '_wma_year', true));
$description = html_entity_decode(get_post_meta($post->ID, '_wma_description', true));
echo '<p><label for="wma_poster_url">';
_e('Poster URL', 'wma_poster_url');
echo '</label></p>';
echo '<p><input type="text" id="wma_poster_url" name="wma_poster_url"' . ' value="' . esc_attr($poster_url) . '" class="widefat" /></p>';
echo '<p><label for="wma_rating">';
_e('Rating', 'wma_rating');
echo '</label></p>';
echo '<p><label for="wma_rating_1">1</label> ' . '<input type="radio" id="wma_rating_1" name="wma_rating"' . ' value="1" ' . ($rating === 1 ? 'checked' : '') . ' /> ';
echo '<label for="wma_rating_2">2</label> ' . '<input type="radio" id="wma_rating_2" name="wma_rating"' . ' value="2" ' . ($rating === 2 ? 'checked' : '') . ' /> ';
echo '<label for="wma_rating_3">3</label> ' . '<input type="radio" id="wma_rating_3" name="wma_rating"' . ' value="3" ' . ($rating === 3 ? 'checked' : '') . ' /> ';
echo '<label for="wma_rating_4">4</label> ' . '<input type="radio" id="wma_rating_4" name="wma_rating"' . ' value="4" ' . ($rating === 4 ? 'checked' : '') . ' /> ';
echo '<label for="wma_rating_5">5</label> ' . '<input type="radio" id="wma_rating_5" name="wma_rating"' . ' value="5" ' . ($rating === 5 ? 'checked' : '') . ' /></p>';
echo '<p><label for="wma_year">';
_e('Year', 'wma_year');
echo '</label></p>';
echo '<p><input type="text" id="wma_year" name="wma_year"' . ' value="' . esc_attr($year) . '" class="widefat" /></p>';
echo '<p><label for="wma_description">';
_e('Short Description', 'wma_description');
echo '</label></p>';
wp_editor($description, 'wma_description');
}
示例10: widget_form_callback
/**
* Short-circuit the WP_Widget_Text form so we can inject our editor
*
* @see WP_Widget::form_callback
*
* @param $instance
* @param $widget
*
* @return mixed
*/
function widget_form_callback($instance, $widget)
{
if (is_a($widget, 'WP_Widget_Text') && false !== $instance) {
add_filter('wp_default_editor', function () {
return 'tinymce';
});
// we need $return for the in_widget_form action
$return = null;
ob_start();
$return = $widget->form($instance);
$form = ob_get_clean();
$top = explode('<textarea', $form);
$bottom = explode('/textarea>', $top[1]);
$top = $top[0];
$bottom = $bottom[1];
ob_start();
?>
<input type="hidden" name="<?php
echo $widget->get_field_name('text');
?>
" value=""><?php
wp_editor(stripslashes($instance['text']), $this->make_editor_id($widget), array('editor_class' => 'sweet-widgets-text-editor', 'editor_height' => '320px'));
$editor = ob_get_clean();
echo $top . $editor . $bottom;
do_action_ref_array('in_widget_form', array(&$widget, &$return, $instance));
$instance = false;
}
return $instance;
}
示例11: textarea
/**
* Подключение CKEditor
* @param string $name - название поле name
*/
public function textarea($name, $text)
{
if (isset($name)) {
$args = array('wpautop' => 0, 'media_buttons' => 1, 'textarea_name' => $name, 'textarea_rows' => 10, 'tabindex' => null, 'editor_css' => '', 'editor_class' => '', 'teeny' => 0, 'dfw' => 0, 'tinymce' => false, 'quicktags' => 1);
wp_editor(isset($text) ? $text : '', $name, $args);
}
}
示例12: generate_metabox
function generate_metabox($post, $args)
{
$data = get_post_custom($post->ID);
$this->post_id = $post->ID;
echo '<input type="hidden" name="' . $this->name . '_noncename" id="' . $this->name . '_noncename" value="' . wp_create_nonce($this->name . '_nonce') . '" />';
foreach ($this->fields as $field) {
if ($field['name'] == 'wp_editor') {
wp_editor($post->post_content, 'content');
} else {
$default = array('type' => 'text', 'name' => '', 'label' => '', 'value' => '', 'default' => '', 'description' => '');
$field = $this->extend($default, $field);
if (isset($data[$field['name']])) {
$val = array('value' => $data[$field['name']][0]);
} else {
$val = array('value' => $field['default']);
}
$field = $this->extend($field, $val);
if ($field['type'] == 'wp_editor') {
wp_editor($field['value'], $field['name']);
} else {
$f = $this->generate_field($field);
echo $f;
}
}
}
add_action('admin_footer', array(&$this, 'admin_footer'));
}
示例13: display_setting
/**
* Display this setting
* @since 2.0
*/
public function display_setting()
{
$this->args['textarea_name'] = $this->get_input_name();
$value = empty($this->value) && !empty($this->default) ? $this->default : $this->value;
wp_editor($value, preg_replace('/[^\\da-z]/i', '', $this->id), $this->args);
$this->display_description();
}
示例14: handsometestimonials_meta_box_callback
/**
* Prints the box content.
*
* @param WP_Post $post The object for the current post/page.
*/
function handsometestimonials_meta_box_callback($post)
{
// Add an nonce field so we can check for it later.
wp_nonce_field('handsometestimonials_meta_box', 'handsometestimonials_meta_box_nonce');
/*
* Use get_post_meta() to retrieve an existing value
* from the database and use the value for the form.
*/
$testimonial_subtitle = get_post_meta($post->ID, '_subtitle_meta_value_key', true);
$testimonial_subtitle_link = get_post_meta($post->ID, '_subtitle_link_meta_value_key', true);
$testimonial_short = get_post_meta($post->ID, '_testimonialshort_meta_value_key', true);
//Subtitle Field
echo '<label for="testimonial_subtitle">';
_e('Testifier\'s Title, Position, or Location: ', 'hndtst_loc');
echo '</label> ';
echo '<input type="text" id="testimonial_subtitle" name="testimonial_subtitle" placeholder="CEO, Acme Corporation" value="' . esc_attr($testimonial_subtitle) . '" size="25" />';
//Subtitle Link Field
echo '<br /><label for="testimonial_subtitle_link">';
_e('Testifier\'s URL: ', 'hndtst_loc');
echo '</label> ';
echo '<input type="text" id="testimonial_subtitle_link" name="testimonial_subtitle_link" placeholder="http://website.com" value="' . esc_attr($testimonial_subtitle_link) . '" size="25" />';
//Short Testimonial Field
echo '<p><label for="testimonial_short">';
_e('<b>Testimonial: </b>', 'hndtst_loc');
echo '</label></p> ';
wp_editor($testimonial_short, 'testimonial_short', $settings = array('textarea_rows' => 5, 'media_buttons' => false));
}
示例15: get_output
public function get_output()
{
$args = array('textarea_name' => 'doesnotmatter', 'media_buttons' => false, 'tinymce' => array('readonly' => 1));
ob_start();
wp_editor($this->get_value(), sprintf('meta-output-%s', $this->get_key()), $args);
return ob_get_clean();
}