There are many cases when you need to add pieces of code or display certain information in your wordpress footer.
You may want to install the analytics tracking code or any other javascript. You can do this by editing the footer.php file but sometimes you may want to add new things without changing theme files.
In this case the best option is to add in function.php the function that will do what you need and then hook it on the proper wordpress action(in this case wp_footer)
The code looks like this:
function do_the_things_you_want() {
// compute & display
}
add_action(‘wp_footer’,’ do_the_things_you_want’);
You can get the same effect for header just by changing the action name .Just replace the wp_footer with wp_head.
