WordPress.org

Support

Support » How-To and Troubleshooting » Allowing < and > to be used

Allowing < and > to be used

  • 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

Viewing 10 replies - 1 through 10 (of 10 total)
  • 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.

    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.

    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.

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

    You could use a filter to call the htmlspecialchars function.

    Mark (podz)

    @podz

    Support Maven

    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 ?

    Mark (podz)

    @podz

    Support Maven

    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.

    Mark (podz)

    @podz

    Support Maven

    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.

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

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

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Allowing < and > to be used’ is closed to new replies.