WordPress.org

Ready to get started?Download WordPress

Forums

How do I run Javascript within a post? (4 posts)

  1. ScottAllen
    Member
    Posted 9 years ago #

    I have a piece of JS code I want to run within a post, but all the quotes -- single or double -- get converted into escape codes and the code doesn't run. What can I use that won't get converted so the code will run?

  2. MattRead
    Member
    Posted 9 years ago #

    You could try taking out the "wp-texturize" filter in /wp-includes/vars.php. it's at the very bottom of that file, just comment it out like this:
    //add_filter('the_content', 'wptexturize');
    I'm not sure if that is going to do it for you though. What's the JS you want to run?
    Also any "texturize" or other plugins might be doing that as well.

  3. ScottAllen
    Member
    Posted 9 years ago #

    I have a couple of pieces of code I want to run. One is the Amazon affiliate code where it's hosted on their site. Another is some code that displays photos of members from another site who are online right now. Pretty hard to run any Javascript code without any quote marks. Also, if I remove that filter, that will impact all my other posts. I'd like to just be able to shut it off for one post, or to have some input character that would produce the correct output characters so I could make the code execute.

  4. MattRead
    Member
    Posted 9 years ago #

    Are you sure it will impact your other posts that much. I find it does more harm than good. I use the "markdown" plugin and disable the wp-texturize, and it works great for me. You should try it and see.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.