WordPress.org

Ready to get started?Download WordPress

Forums

WP is not accepting the code of Firefox Referral button (38 posts)

  1. manstraw
    Member
    Posted 7 years ago #

    Otto - oh yeah baby. I'm glad you thought it was easy.

    ah, I see you just moved it. clever donkey! I was trying to code in another (.*). silly me.

    oh well, could be worse, I cudda usta bin smart.

    nazgul - I haven't checked your change. was it pretty much the same thing?

  2. Nazgul
    Member
    Posted 7 years ago #

    Manstraw, not entirely, I created a pre and post event around wpautop.

    In the pre event, I replace the newlines which shouldn't become BR's (in script and style tags) with a temporary tag, which I replace back to newlines in the post event.

    The advantage of this is that the plugin doesn't need updating if the wpautop function gets changed in the wordpress core.

  3. manstraw
    Member
    Posted 7 years ago #

    good stuff nazgul.

    I'm installing both in my test system.

  4. Nazgul
    Member
    Posted 7 years ago #

    I've posted this issue to trac as well.

  5. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Nazgul: The only problem I have with that approach is that it's altering the script. While it is indeed doing so in a way that's safe, I was trying more to preserve the script as-is, since some people (Google Adsense) don't like when their script gets altered.

    I had not considered using a pre and post method though.

    As for wpautop, it hasn't changed in a while, has it? It's mostly taken from other code anyway, I've seen similar code in TextPattern or one of the other blogging packages, I think.

  6. Nazgul
    Member
    Posted 7 years ago #

    Otto42: It does change the script, but only temporarily. By the time it leaves the post-wpautop method, it's again exactly the same as the user entered it.

  7. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Nazgul: Yes, but by leaving it there, it has the potential for wpautop to mess with the script in other ways. If the script contains html code, for example, it could get hosed in some way. Better to pull the script out entirely and put it back afterwards.

  8. Nazgul
    Member
    Posted 7 years ago #

    I partly agree with you.

    But I think this suffices for some basic javascript inclusions in the text. Writing entire "javascript libraries" in posts is a bad idea anyway.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags