对文章进行评论时如何调用WordPress编辑器?

  也许您认为WordPress的默认评论编辑器太单调了,为了使其支持更多的功能,需要进行大量的修改,因为WordPress3.3+版本支持wp_Editor函数,我们可以直接调用WordPress自己的编辑器、可视化或HTML,我们可以很容易地在任何地方调用它。那么对文章进行评论时如何调用WordPress编辑器?

对文章进行评论时如何调用WordPress编辑器? (https://www.wp-admin.cn/) WordPress使用教程 第1张

  wp_editor函数调用格式

  <?php wp_editor( $content, $editor_id, $settings = array() ); ?>

  如果$content的值对应于注释框的内容,则将其保留为空;$Editor_id对应于id=”comment”;其余设置被放置在$settings数组中。

  找到主题评论框代码

  <textarea name=”comment” id=”comment” rows=”6″></textarea>

  替换为:

  <?php wp_editor( ”, comment, $settings = array( ‘quicktags’=>1, ‘tinymce’=>0, ‘media_buttons’=>0, ‘textarea_rows’=>4, ‘editor_class’=>”textareastyle” ) ); ?>

  在上述代码中:

  quicktags是HTML模式;

  tinymce是一个可视模式,值1和0表示它是打开或关闭的;

  media_buttons是一个上传文件(只有博客用户登录后才显示,访问者不可见) ;textarea_rows是默认的行数 ;

  editor_class是将自定义类添加到WP附带的编辑器Ttextarea区域。

相关推荐

发表回复

房先生
我们将24小时内回复。
2024-07-16 07:41:55
您好,有任何疑问请与我们联系!
您的工单我们已经收到,我们将会尽快跟您联系!
[QQ客服]
2781198
加我微信
[电话联系]
13585372227
[电子邮件]
chaoneo@163.com
取消

选择聊天工具: