我是wordpress主题开发的新手…
我知道要在wordpress主题中创建主题选项, 但是现在我想使用wordpress的WYSIWYG编辑器wp_editor(), 我已经阅读了一些有关此内容的文章, 但我做不到…
这是我的代码:
add_settings_field('tinytxt', 'WYSIWYG: ', array($this, 'tinytxt'), 'oditer_theme_options', 'jd_theme_options_main_section');
public function tinytxt() {wp_editor("{$this->
options['tinytxt']}", 'tinytxtboom');
}
以及如何从数据库中检索保存的内容, 我知道使用get_option()…
【如何使用wp编辑器】提前致谢…
#1你需要为你的WordPress编辑器输入一个名称, 以便它可以保存值。
wp_editor( $this->
options['tinytxt'], 'tinytxtboom', array(
'textarea_name' =>
'jd_theme_options[tinytxt]'
) );
这将使隐藏的文本区域wp_editor使用名称来提交表单。 jd_theme_options将第二个参数与register_setting匹配, tinytxt是要在其中保存值的选项键。
我认为这就是你所需要的。如果遇到问题, 请发表评论。我明天回来检查。
你也可以尝试使其仅在简单的textarea上运行, 然后尝试使wp_editor运行。
推荐阅读
- 如何使用Redux Framework Sorter选项()
- 如何在WordPress meta框中使用破折号或图标()
- 如何在Adapt wordpress主题的主页上显示类别的图像缩略图(免费版)
- 如何在wordpress主题的不同页面上显示不同的logo()
- 如何设置分类列表限制()
- 如何在wordpress中更新更新后的元数据上保存多个复选框()
- 如何从子主题中删除WordPress主题选项
- mysql配置主从配置遇到的坑
- AWS EKS Horizontal Pod Autoscaler(HPA)