University of Oregon

Redux: Add a button to your wyswyg html bar in WP -Code2

As a follow up to Add a button to your wyswyg html bar in WP. I wanted to create a code button that prompts me for the code language. And if there’s none then use the simple tag.

So back to blog/wp-includes/js/quicktags.js. This time I needed to do more than add a simple button.
After a few attempts to do this from scratch I realized that I needed a function similar to the add link function that the link button uses. (more…)

Add a button to your wyswyg html bar in WP

NOTE: this post has a follow up here: http://pages.uoregon.edu/vid/2009/09/02/redux-add-a-button-to-your-wyswyg-html-bar-in-wp-code2/

I wanted to accommodate a new plugin I installed for highlighting code: Ion Syntax Highlighter. I was surprised that it didn’t append my quicktags button bar in the wyswyg edtitor.
I couldn’t remember the syntax either and I wanted to be able to use my button! I expected the behavior of the code button to change after I installed but not so. I did a quick search in the source and found that I needed to look for quicktags. I found what I needed here “blog/wp-includes/js/quicktags.js”

I duplicated the existing “code” code and and replaced instances of “code” with “code2”.

For example a search in the source of quicktags.js revealed this: (more…)