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 tagthat will allow anything that's placed betweenandto 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
<tr><td>
</td></tr>
it will be shown like this
<tr><td><br \>
</td></tr><br \>
however if you do the following:
<tr><td>
</td></tr>
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'
,'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.