Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

damiroquai on "Is this corect syntax for adding java script to plugin?"

$
0
0

I wanna create plugin wich will place google analytics code or any other js code in footer.
Can I do it like this?

<?php
   /*
    Plugin Name: myplugin
    Plugin URI:
    */

function myganalytics() {
?>
<script>
// my google analytics script
</script>
<?php
}
   add_action('wp_footer', 'myganalytics');
?>

Viewing all articles
Browse latest Browse all 8245

Trending Articles