I have a page template which is applied to a specific page on my wordpress page. Usually for all of my other scripts i put them in my footer.php and they load from there beautifully. On this specific page though I want to load a script that only should be running on this page. So in my template i include it like this:

<?php
/**
* Template Name: Template
*/
?>
<?php get_header(); ?>

<script src="<?php echo get_template_directory_uri(); ?>/js/teacher-signup.js"></script>

<?php get_footer( ); ?>

Unfortunately when doing that I only get errors like:

Uncaught TypeError: $(…).whatever is not a function

Is there some way in WordPress to include a couple of scripts on a specific template only? Or am I missing something?

Thanks in advance

Read more here: Including jQuery script on wordpress template


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: