WordPress.org

Ready to get started?Download WordPress

Forums

Allowing < and > to be used (11 posts)

  1. h00psta
    Member
    Posted 10 years ago #

    Hi,
    I've recently set up WordPress to be used to store IRC quotes. If you're familiar with IRC, nicks are logged as <Nickname>. However, When submitting, the this is removed entirely. Is there any way to stop WordPress interpreting that as an HTML tag?
    Thanks

  2. h00psta
    Member
    Posted 10 years ago #

    Hmmm. Evidently there is, because otherwise the above <Nickname> would not have been displayed. Does anyone know how I can change this setting?
    Thanks again.

  3. sakamuyo
    Member
    Posted 10 years ago #

    This forum isn't using WP, so what you see here doesn't necessarily translate into an easy way of doing it in WP.
    One option would be to treat the nicknames as "code" placing the code tags around the names. Not only would it not strip it as HTML, it would put the names into a monospace font, which might be a neat effect.

  4. Matt Mullenweg
    Troublemaker
    Posted 10 years ago #

    You need to learn how to encode entities in HTML. < and > have special meanings in HTML, so to display those characters you need to use their HTML entity equivilents.

  5. Matt Mullenweg
    Troublemaker
    Posted 10 years ago #

    Sakamuyo, puting around the names will not change anything, nor should it. You need to encode the greater than and less than signs.

  6. Matt Mullenweg
    Troublemaker
    Posted 10 years ago #

    You could use a filter to call the htmlspecialchars function.

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

    h00psta - are you wanting to do a lot at once ?
    If so, try this: http://resources.wordpress.org/tools/encode/
    Paste what you want in, encode, copy and paste into the blog.
    If it's more occasional, a Quicktag could be written to put a < or a > in when you click a button ?

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

    Quicktag to do the job.
    Download quicktags.js
    Open in WordPad.
    Find the section with entries simlar to this, and paste these entries underneath:
    edButtons[edButtons.length] = new edButton('ed_<'
    ,'<'
    ,'<'
    ,''
    ,''
    );
    edButtons[edButtons.length] = new edButton('ed_>'
    ,'>'
    ,'>'
    ,''
    ,''
    );

    If this does not encode properly here, the entry that has second '<' should have & l t ; there instead (no spaces between those letters) and for the second '>' it should have & g t ; - again, no spaces.

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

    Not in Quicktags .. that's not a filter at all, that just helps cut down on manually entering code.
    If it's a long list, I'd use the encode link.

  10. Matt Mullenweg
    Troublemaker
    Posted 10 years ago #

    You could just use a filter to call the htmlspecialchars function.

  11. DaftPunkEZLN
    Member
    Posted 10 years ago #

    Hi, probably a very obvious question, but in relation to calling the htmlspecialchars function with a filter, how do I go about doing this?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.