Jump to content


Photo

Add "pre" button to quick button bar in text editor


  • Please log in to reply
No replies to this topic

#1 John

John

    Administrator

  • Administrators
  • 73 posts

Posted 24 November 2013 - 02:09 PM

I work in the "Text editor" of Wordpress a lot, I like it better than the "Visual editor" for some reason. What I really miss is a pre code wrapper, so that's why I added one myself manually. Here's how I did it:
 
1) Edit the functions.php file in the Themes folder
 
2) Add this code at the end of the file:
 
add_action('admin_print_footer_scripts','eg_quicktags');
function eg_quicktags() {
?>
<script type="text/javascript" charset="utf-8">
QTags.addButton( 'eg_pre', 'pre','<pre>', '</pre>', 'q' );
</script>
<?php
}
3) Save the file and voilĂ , you are done!
 





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users