So I've got a bit of an issue, and not sure what the problem is. I'm trying to enqueue javascript in the footer of my Wordpress site. The footer looks like this:
</footer>
</div>
<?php wp_footer(); ?>
<script>
jQuery(document).foundation();
</script>
</body>
</html>
So the enqueued script SHOULD be put in the wp_footer call, putting the script just above where I actually call it. But looking at the source code of the file, I get this:
</footer>
</div>
<script>
jQuery(document).foundation();
</script>
<script type='text/javascript' src='http://www.thetestsite.com/wp-content/themes/cornerstone-4.3.1/js/foundation.min.js?ver=4.3.3'></script>
</body>
</html>
For some reason, the script in question is being placed RIGHT BEFORE the closing body tag.
I verified the wp_footer is in the correct place, so I'm not sure what would cause this to happen. If I enqueue the script to the head, it works just fine, but I'm just curious as to why this behavior is happening.
UPDATE (NEW CODE): Sorry for the confusion. Here's the functions.php portion of the script enqueue method:
function load_cornerstone_scripts() {
wp_enqueue_script(
'foundation_js',
get_template_directory_uri() . '/js/foundation.min.js',
array('jquery'),
'4.3.1',
true
);
}
add_action('wp_enqueue_scripts', 'load_cornerstone_scripts',0);
So to be clear..the original two blocks of code are showing 1) What the php file footer.php looks like, and 2) what the source code is rendered as.