How can I put javascript in my WordPress pages?

Discussion in 'WordPress' started by tibberous, Jan 21, 2008.

  1. #1
    I have a site that needs javascript code put in one of the pages. WordPress keeps escaping single quotes between tags, which is breaking my code. Is there some way around this? I found an extension that is supposed to prevent this but it only works for posts, not pages.
     
    tibberous, Jan 21, 2008 IP
  2. sundaybrew

    sundaybrew Numerati

    Messages:
    7,294
    Likes Received:
    1,260
    Best Answers:
    0
    Trophy Points:
    560
    #2
    Just hit "code" or "source" depending on what wsy editor you have installed and then add the code :)
     
    sundaybrew, Jan 21, 2008 IP
  3. tibberous

    tibberous Well-Known Member

    Messages:
    216
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #3
    Doesn't work - wordpress replaces a bunch of characters with thier entity versions, which breaks the code.
     
    tibberous, Jan 21, 2008 IP
  4. robojiannis

    robojiannis Peon

    Messages:
    45
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I think wordpress is incompatible with javascript
     
    robojiannis, Jan 22, 2008 IP
  5. arwen54

    arwen54 Active Member

    Messages:
    632
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    60
    #5
    if you want to add javascript to a page you're going to have to turn off the visual editor and use the HTML editor to edit your WordPress pages

    click "Users", click "Your Profile", and then uncheck "Use the visual editor when writing"
     
    arwen54, Jan 22, 2008 IP
  6. tibberous

    tibberous Well-Known Member

    Messages:
    216
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #6
    Yeah, that doesn't work. It escapes single quotes inside tags. I got my site done by making a standalone page. Basically you need to make a file with everything inside your page template, then add the line:

    <?php require_once('wp-blog-header.php'); ?>

    That way it can call the wordpress functions like wp_footer(); and wp_sidebar(); Then you can just write you contents right into the page - just sucks because if you change the page template this page won't update.
     
    tibberous, Jan 22, 2008 IP