Skip to content

Instantly share code, notes, and snippets.

@clawfire
Created May 20, 2011 12:51
Show Gist options
  • Save clawfire/982827 to your computer and use it in GitHub Desktop.
Save clawfire/982827 to your computer and use it in GitHub Desktop.
Let Some JS file know some Wordpress Constant
<?php
/**
* DEFINVE SOME VARIABLE FOR MY JS FILES
*/
function environment_var(){
?>
<script type="text/javascript">
var templatePath = "<?php bloginfo('template_directory') ?>";
</script>
<?php
}
add_action('wp_head', 'environment_var');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment