Adding code to posts – revisited
After doing some reading and looking around I figured out a way to insert code into html without all the messy string replaces.
Here’s the, html support a tag
that will allow anything that's placed between
andto not be parsed. The problem with this is that first of all WP adds <br> to the end of every line so if you do this
it will be shown like this
however if you do the following:
then the code will be shown in the right way.
To help you guys who don't want to type out the tags all the time. Add the following lines to after line 119 in your quicktags.js It will give you a button called code that will write the tags for you.
edButtons[edButtons.length] = new edButton('ed_code'
I would highly recommend using CSS to customize the appearance of the code tag.
- The topic ‘Adding code to posts – revisited’ is closed to new replies.