跳至主要内容

给wordpress增加quicktags按钮的方法"

给wordpress增加quicktags按钮的方法,这次是中文的,应该更有亲和力。
 
原文:
 

以前就有人说过,我的那些插件都不能在后台的编辑器的 quicktags 按钮中出现,编辑的时候要自己敲入那些标签,很麻烦,希望我的插件能够提供在后台编辑器上显示 quicktags 按钮的功能,这个功能要用插件实现不太容易,反正我没找到合适的方法,而且现在 wordpress 的那个文档网站 我这里上不去,因此编写插件时很麻烦。其实要增加那些标签不一定非要在插件里提供这个功能,自己修改一下 wp-includes\js\quicktags.js 文件就可以实现了。增加一个标签按钮只需要几行代码。例如:

增加 PagePost 插件的按钮,在edButtons[edButtons.length] =
new edButton('ed_more'
,'more'
,'<!--more-->'
,''
,'t'
,-1
);
后面增加edButtons[edButtons.length] =
new edButton('ed_page'
,'page'
,'<!--page-->'
,''
,'p'
,-1
);
即可。同时你会发现,其实 wordpress 本来就带有一个分页标签 <!–nextpage–>,只是它在 quicktags 中默认被注释掉了,所以默认不显示这个标签。这个标签的功能,跟 pagepost 插件提供的功能类似,不过 pagepost 还提供里了一个完整显示的功能。而 <!–nextpage–> 这个标签没有这个功能。

如果要增加 CoolCode 插件的标签,在edButtons[edButtons.length] =
new edButton('ed_code'
,'code'
,'<code>'
,'</code>'
,'c'
);
之后插入edButtons[edButtons.length] =
new edButton('ed_coolcode'
,'coolcode'
,'<coolcode>\n'
,'\n</coolcode>'
,''
);
即可。

增加 CoolPlayer 插件,则插入edButtons[edButtons.length] =
new edButton('ed_coolplayer'
,'coolplayer'
,'<coolplayer>'
,'</coolplayer>'
,''
);
即可。

是不是很简单啊?

评论

此博客中的热门博文

How to Design a Store Front Sign

In this Article we will talk about designing a store front for a business. What color or size should your Letters & designs be? What to put on your sign and why?, then be ready to Get in touch with sign people and get your best deal. Large lettering with out a front sign could save you time and money Do your products have a special shape or color to emulate on your sign? Kodak is always in yellow and black, Coca-Cola white on red, Etc. Muffler places, have a sign in the shape of a muffler. your phone number on the store front some place, but not on the identification sign, (door, or window) Your Product & logos can be arranged on the front sign, or window. Not on the Pole sign, Store hours & phone number could fit in your design and by using the product color, it could add product recognition & enhance your design. Suppliers may provide plenty of advert...

Can Microsoft and Yahoo Co-Create New Businesses?

Negotiating The Future of Management Podcast Current Interactive Case Study Respectfully there's a parallel in modern history here. China-HongKong merger. It started as Two System One China. Controversial at that time. Now, many don't mind which system is better (respectfully just an opinion). Both are getting the best of each other under one country. Families are reunited regularly. Corporate identities sometimes focuses too much on what's different as a strategy. It may provide superiority, but does it always guarantee sustainability? Nature advocates the flourishing of various species; pursues diversity not for purposes of destruction but for better adaptability. Of the whole system. Being different doesn't mean one must separate oneself from the "whole" system. "Different" here is to provide a unique contribution to pserve the "whole". Task / role distribution , not identity separation. Preserving the whole system by b...

MP3 firmware upgrade --- switch

1: The most simple if the host machine using Sigma firmware and upgrade program is one! MP3 can be connected to the computer as long as the firmware installed on the computer, and then click on the face of that to upgrade the line of MP3! three antelope 7530 master points in several ways is to first get the firmware is sent to the machine within the sub-sub-folder off the machine DVR will automatically upgrade! Detailed steps have been described in general firmware! Shenzhen City Qing Wei Digital Appliance Co., Ltd.-KINGWAY http://www.kingwon.com.cn/ Technology Co., Ltd. Shenzhen, Pu-chih http://www.poozi.com/down.asp?le ...% D4% D8 & offset = 5 Section Crystal: http://www.fangke-model.com/ Chuanqi (ONKI): http://www.onki.cn/download.asp brother extremely grateful! CDT CDT http://xinvo.com/web/ ExcelStor MP3 http://www.hua-sun.com/xiazai.htm Bester http://www.szbaisite.com Beto www.beto.cn Butterfly www.it8.com.cn Acorp www.acorp.net.cn BES www.bes-chi...