I just created a web page that uses a lot of JavaScript to build a fancy form that helps build an build the object/html behind an mp3 player for a user. I got it working and tested in a plain-html page outside of WordPress.

I then copied into a WordPress "page", took out the <head> tag, changed <body> to a <div>, but no luck.

Can it even be done?

I also want to use a small javascript to open up a video-player in a new small browser-window.

Working on raw html page: http://learnhowtoputaudioonyoursite.com/TestMP3Player.html

Not working in WP page: http://learnhowtoputaudioonyoursite.com/build-player

  • 1
    Yes, it can be done. Here's a WordPress post that uses canvas, and Dojo / Dijit (side and bottom sliders). pp19dd.com/2010/10/canvas-sine-wave
    – pp19dd
    Commented Jun 29, 2011 at 20:17
  • I looked at the code there, but it's hard to tell what was put in the WP Page vs the theme. Do I have to change my theme to do it? I put my pages in orig post. Commented Jun 29, 2011 at 20:23

2 Answers 2


You'd be much better off creating a custom page template, pasting your HTML into the file, then simply attaching the template to a page in the admin.

WordPress applies a lot of filtering on post/page content, and it's probably wreaking havoc with your code (not to mention you've got things there that belong in the <head />).

UPDATE: Create a PHP file in your theme folder (name it template-something.php);

Template Name: My Template Something

<!-- any PHP & HTML goes here!! -->
<!-- Note: Should be a complete HTML document if not calling get_header() -->
  • Ok, trusting this is best answer. Sounds like a few hours of research... Commented Jun 29, 2011 at 20:47
  • @NealWaters, not at all. See my revised answer! Commented Jun 29, 2011 at 20:54
  • @TheDeadMedic - Yea, right! Thanks, I am very technical, but this is new ground. I renamed my .html page to .php, added the php tag at top/bottom, put an "echo" with a heredoc on all my HTML (also tried no PHP tag). I created a new page in WP, and set it's parent to my new template, and put "What will happen here" in the page-contents. When I view, only "What will happen here" shows (but correctly in the theme with header/sidebar). Nada, not even the H1 from the template is showing. Still don't understand how/where it merges the head/body with the parent theme. Commented Jun 29, 2011 at 21:34
  • @TheDeadMedic - Let me look further, I think I picked the wrong item from the list, and my new template is not on the list... Commented Jun 29, 2011 at 21:40
  • @TheDeadMedic - Ok, I didn't realize the comment was actually important! Got the page to come up, but now with none of the theme. Which I could have basically done by linking to an .html or .php page. So now, I presume, the goal will be to put the theme elements back in, by copying/pasting from some other template. Commented Jun 29, 2011 at 21:44

See the following article by wordpress on registering scripts into Wordpress so that they can be used and loaded. http://codex.wordpress.org/Function_Reference/wp_enqueue_script

wp_enqueue_script( $handle ,$src ,$deps ,$ver ,$in_footer );

Especially helpful as Wordpress is biased toward JQuery. Hope this helps.

  • 1
    How exactly does that solve the question?
    – fuxia
    Commented Oct 16, 2012 at 4:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.