I have a contact form that I would to place within my WordPress theme that pulls in specific Javascript AND CSS Files.
To pull in the Javascript (called x.js) is this correct? I tested it and it seems to work fine, I just want to see whether I've done this correctly!
Also - would I do exactly the same for a .css file?
Here's the php code I placed in the functions file:
add_action('wp_enqueue_scripts','contactform');
function contactform(){
if ( is_page_template('page-contact.php') ) {
wp_enqueue_script('contact-javascript', 'js/x.js');
}
}
Thanks for all help.