Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question
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 Jun 29 '11 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. –  NealWalters Jun 29 '11 at 20:23
add comment

2 Answers 2

up vote 1 down vote accepted

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);

<?php
/*
Template Name: My Template Something
*/
?>

<!-- any PHP & HTML goes here!! -->
<!-- Note: Should be a complete HTML document if not calling get_header() -->
share|improve this answer
    
Ok, trusting this is best answer. Sounds like a few hours of research... –  NealWalters Jun 29 '11 at 20:47
    
@NealWaters, not at all. See my revised answer! –  TheDeadMedic Jun 29 '11 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. –  NealWalters Jun 29 '11 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... –  NealWalters Jun 29 '11 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. –  NealWalters Jun 29 '11 at 21:44
show 2 more comments

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.

share|improve this answer
1  
How exactly does that solve the question? –  toscho Oct 16 '12 at 4:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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