Created
December 6, 2013 22:50
-
-
Save ethanhinson/7833505 to your computer and use it in GitHub Desktop.
Attaching JS to every page's footer in with WordPress best practices.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* All code should live in functions.php of the active theme | |
*/ | |
function attach_js() { ?> | |
<script type="text/javascript"> | |
document.write('ALL MY JS CAN GO IN BETWEEN THESE SCRIPT TAGS'); //Test script only, not required | |
</script> | |
<?php } | |
// Adds an action the footer of every page. In this case, just add some JS | |
add_action('wp_footer', 'attach_js'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment