Adding a cite button in the editor
Monday, April 21st, 2008For the type of content written for dagensskiva.com the ‘code’ button in the editor has no use whatsoever. Instead we find much more use for a ‘cite’ button, a tag that is frequently added to posts, but there is no button for it. This JavaScript snippet will replace the code button with a functional cite button:
index = edButtons.length;
edButtons[index] = new edButton('ed_cite', 'cite', '<cite>', '<\/cite>','c');
jQuery('#ed_code').attr('value', 'cite');
jQuery('#ed_code').attr('onclick', 'edInsertTag(edCanvas, ' + index + ');');
jQuery('#ed_code').attr('id', 'ed_cite');
This code registers the button, then changes the properties of the ‘code’ button to transform it into a ‘cite’ button. Works in both WordPress 2.3 and 2.5.