Skip to content

Instantly share code, notes, and snippets.

@webhasan
Created January 28, 2014 09:53
Show Gist options
  • Save webhasan/8664903 to your computer and use it in GitHub Desktop.
Save webhasan/8664903 to your computer and use it in GitHub Desktop.
wp: quicktags
// Add buttons to html editor
add_action('admin_print_footer_scripts','eg_quicktags');
function eg_quicktags() {
?>
<script type="text/javascript" charset="utf-8">
/* Adding Quicktag buttons to the editor Wordpress ver. 3.3 and above
* - Button HTML ID (required)
* - Button display, value="" attribute (required)
* - Opening Tag (required)
* - Closing Tag (required)
* - Access key, accesskey="" attribute for the button (optional)
* - Title, title="" attribute (optional)
* - Priority/position on bar, 1-9 = first, 11-19 = second, 21-29 = third, etc. (optional)
*/
QTags.addButton( 'eg_paragraph', 'p', '<p>', '</p>', 'p' );
QTags.addButton( 'full_width_image', 'Tutoril Image','<div class="tutorial_image">', '</div>', 'q' );
</script>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment