WordPress.org

Forums

Adding code to posts - revisited (2 posts)

  1. bitziz
    Member
    Posted 10 years ago #

    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 and to 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.

  2. gadlen
    Member
    Posted 10 years ago #

    This HTML code insertion hack is exactly what I'm looking for. Unfortunately, it doesn't seem to be working... and since it's not working, I can't even read the entirety of your post! If you've got a solution, I'd love to hear it! This one has been driving me crazy! Reach me at http://lee.org.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.