WordPress.org

Ready to get started?Download WordPress

Forums

HTML Code in Post (11 posts)

  1. MattRead
    Member
    Posted 10 years ago #

    Does anyone know if there is a hack to DISPLAY HTML code in the post content, something like backticks on this forum??
    If not, does anyone feel like writing one? I will give you autographed picture of Fred if you write one!! If that's not enough motivation, then I don't know what is. :) :)
    I run the tweaks/software section of my site with wordpress and put a lot of HTML in the posts, and currently have to convert everything to Special Characters.
    http://www.mattread.com/tweaks/

  2. Anonymous
    Unregistered
    Posted 10 years ago #

    How about html or scripts in the sidebar.
    I want to run a countdown code and other stuff, but I don't know how to include it in my sidebar...
    Any help would be appreciated.
    Thanks
    Nettie xox
    http://keanuholic.com

  3. Mark (podz)
    Support Maven
    Posted 10 years ago #

    I use the WP widget:
    http://resources.wordpress.org/tools/encode/
    but a plugin would be cool.

  4. ringmaster
    Member
    Posted 10 years ago #

    Here you go, "Code Filter":
    http://www.asymptomatic.net/wp-hacks/
    Where's my picture?

  5. Mark (podz)
    Support Maven
    Posted 10 years ago #

    One thing to note :
    Break your code up into smaller lines, or it will continue to the right !

  6. MattRead
    Member
    Posted 10 years ago #

    That Plugin is awsome. That's exactly what I wanted, and I do mean exactly.
    Oh and here's your picture:
    http://www.mattread.com/i/mfr.jpg
    "It's a wonderful day in the neighboorhood...."

  7. ringmaster
    Member
    Posted 10 years ago #

    Sweet. :)

  8. Zarniwoop
    Member
    Posted 10 years ago #

    Maybe you can also try out the Markdown plugin (included with WP) which has support for displaying code and doesn't even need the -tags. At the other side, it is much more than that and for this cannot be use in conjunction with Textile because they do the same things, but in different ways.

  9. MattRead
    Member
    Posted 10 years ago #

    I have a problem with the Plugin. if I have more than on instance of the "code" tags then it displays the middle "code" tags as special characters.

    <html></>

    Plain Text

    The above will display "Plain Text" and the middle "code" tags as preformatted text <pre>

  10. ringmaster
    Member
    Posted 10 years ago #

    You can fix this by putting a "U" after the "ims" in the regular expression. The expression would then read like this:
    '|<code([^>]*)>(.*)|imsU'

    The "U" makes the expression ungreedy, so it only looks for the first matching end tag rather than the last.

  11. loauc
    Member
    Posted 9 years ago #

    and how can I put code in the comments? I've tried using the code tag but it doesn't work. Would a pre tag work?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.