Skip to content

给 WordPress 增加 quicktags 按钮

要给WordPress的编辑器增加快速标签,不一定非要用插件,自己修改一下 wp-includes\js\quicktags.js 文件就可以实现了。增加一个标签按钮只需要几行代码。例如: 增加 PagePost 插件的按钮,在:

edButtons[edButtons.length] = new edButton('ed_more' ,'more' ,'' ,'' ,'t' ,-1 );

的后面增加:

edButtons[edButtons.length] = new edButton('ed_page' ,'page' ,'' ,'' ,'p' ,-1 );

即可。

同时你会发现,其实 wordpress 本来就带有一个分页标签 ,只是它在 quicktags 中默认被注释掉了,所以默认不显示这个标签。这个标签的功能,跟 pagepost 插件提供的功能类似,不过 pagepost 还提供里了一个完整显示的功能。而 这个标签没有这个功能。 如果要增加 CoolCode 插件的标签,在:

edButtons[edButtons.length] = new edButton('ed_code' ,'code' ,'' ,'' ,'c' );

之后插入:

edButtons[edButtons.length] = new edButton('ed_coolcode' ,'coolcode' ,'\n' ,'\n' ,'' );

即可。 增加 CoolPlayer 插件,则插入

edButtons[edButtons.length] = new edButton('ed_coolplayer' ,'coolplayer' ,'' ,'' ,'' );

即可。

Categories: WordPress.

Tags: , ,

Comment Feed

No Responses (yet)



Some HTML is OK

or, reply to this post via trackback.