Using a form with javascript on Wordpress?

Soldato
Joined
6 Jan 2006
Posts
3,384
Location
Newcastle upon Tyne
I have a couple of forms that I would like to add to different pages on my WP site, however they have javascript that comes with them that needs to be added to the <head> section. Is there a way I can just add the javascript to the page that requires them of will I have to add them to the global <head> section which will then appear on every page?

Not sure if there is a simple way to solve the above but Ive never really done anything with forms so might be missing something obvous but it appearing on every page doesnt seem like a very effecient way of doing things.

Thanks
 
You can use:
Code:
is_page('Contact');
or...
is_page(4);
where 4 is the corresponding page id.

For example if you wanted to add the JavaScript to the "About" and "Contact" pages:
Code:
if(is_page('About') || is_page('Contact')){
echo '<script src="filename.js"></script>';
}
 
Back
Top Bottom