Thord Daniel Hedengren - Smashing WordPress_ Beyond the Blog-Wiley (2014)

(avery) #1

CHAPTER 6 • Advanced Theme Usage 157


HOOKING ON


If you want to hook on to one of WordPress’s action hooks, say by adding some web statistics
code to the wp_footer hook, you can do it in functions.php. You write a PHP function
containing the stuff you want to add, and then you add it to the hook.


Start with the function. The actual analytics script code is just nonsense, so if you want to use
this particular hook you should, of course, swap the code for your own:


<?php function my_webstats() { ?>