我发现了,Wordpress进行了更改,现在您可以通过一个简单的API添加按钮
if( !function_exists(\'_add_my_quicktags\') ){
function _add_my_quicktags()
{ ?>
<script type="text/javascript">
/* Add custom Quicktag buttons to the editor Wordpress ver. 3.3 and above only
*
* Params for this are:
* string id Required. Button HTML ID
* string display Required. Button\'s value="..."
* string|function arg1 Required. Either a starting tag to be inserted like "<span>" or a callback that is executed when the button is clicked.
* string arg2 Optional. Ending tag like "</span>"
* string access_key Optional. Access key for the button.
* string title Optional. Button\'s title="..."
* int priority Optional. Number representing the desired position of the button in the toolbar. 1 - 9 = first, 11 - 19 = second, 21 - 29 = third, etc.
* string instance Optional. Limit the button to a specific instance of Quicktags, add to all instances if not present.(optional)
*/
QTags.addButton( \'php\', \'PHP\', \'[ php gutter="false" ]\', \'[ /php]\' );
QTags.addButton( \'js\', \'JS\', \'[ js gutter="false"]\', \'[ /js]\' );
QTags.addButton( \'h2\', \'H2\', \'< h2>\', \'< /h2>\' );
QTags.addButton( \'h3\', \'H3\', \'< h3>\', \'< /h3>\' );
QTags.addButton( \'promt\', \'Prompt\', function(){
QTags.insertContent(window.prompt() )
});
</script>
<?php }
// We can attach it to \'admin_print_footer_scripts\' (for admin-only) or \'wp_footer\' (for front-end only)
add_action(\'admin_print_footer_scripts\', \'_add_my_quicktags\');
}