我想在新帖子页面上为tinyMCE编辑器添加一个按钮 . 随着this toturial我设法让按钮完美运行,但有些东西我无法't figure out. When you insert a 1179275 tag, an image will appended to the html with appropriate ' background-image' . 见截图:
但是当你切换到'Text'模式时,会出现如下的html注释: <!--more-->
.
我可以在html中添加图像,但在'Text'模式下有一个 img
标记 .
我想要这样的东西: <!--my-custom-tag-->
wordpress如何设法做到这一点?或者我怎样才能在tinyMCE编辑器上附加自定义标签?
2 回答
我找到了答案 . 您需要在编辑器对象上添加
BeforeSetContent
和PostProcess
事件(如前所述,首先按照this toturial添加按钮):或者你可以做一个短代码 . 我总是使用它你可以写你自己的代码让你理解它 . 很少甚至没有从tinymce写jQuery!
example
https://codex.wordpress.org/Function_Reference/add_shortcode