The WordPress QuickTags API permits you to add buttons to the WordPress admin textual content material editor. To be honest, the textual content material editor may be a lot much less used than the rich editor, by the best way during which together with quick tags could also be pretty useful when repeating the similar duties pretty sometimes.
Proper right here is the itemizing of default quick tags provided in WordPress:
As you may even see you could create quite a few form of buttons, assign an entry key to each of them and description your private personalized code merely.
QTags.addButton( id, present, arg1, arg2, access_key, title, priority, event );
This function accepts eight arguments:
- id: (string) (required) The html id for the button
- present: (string) (required) The html value for the button
- arg1: (string) (required) Each a starting tag to be inserted like “<span>” or a callback that is executed when the button is clicked
- arg2: (string) (optionally obtainable) Ending tag like “</span>”. Depart empty if tag doesn’t should be closed (i.e. “<hr />”)
- access_key: (string) (optionally obtainable) Shortcut entry key for the button
- title: (string) (optionally obtainable) The html title value for the button
- priority: (int) (optionally obtainable) A amount representing the required place of the button throughout the toolbar. 1 – 9 = first, 11 – 19 = second, 21 – 29 = third, and so forth
- event: (string) (optionally obtainable) Limit the button to a specific event of Quicktags, add to all conditions if not present
This is a full snippet that gives a WPSaviour hyperlink to the editor:
Proper right here is the result:
To utilize that quick tag, click on on as quickly as on it, it might probably insert the beginning of the <a> tag, add some textual content material, and click on on the button as soon as extra, this may increasingly add the closing </a> tag. That’s it!