Title: Adding custom PHP code and tracking codes in footer ?
Last modified: August 21, 2016

---

# Adding custom PHP code and tracking codes in footer ?

 *  Resolved [avil](https://wordpress.org/support/users/avil/)
 * (@avil)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/adding-custom-php-code-and-tracking-codes-in-footer/)
 * Hi
 * This is a very nice theme, I’m currently testing in my localhost and plan to 
   setup on my site very soon.
 * I have some custom php files which I include in my current theme using the following
   code, but I’m unable to figure out where to include in this theme.
 * `include(TEMPLATEPATH . '/filename.php');`
 * I tried adding adding it to the end of footer.php but it does not seem to be 
   working.
 * Kindly suggest how to include custom file and where to place the code for footer
   specific codes like analytic/tracking/etc.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Theme Author [heatmap](https://wordpress.org/support/users/stuartwider/)
 * (@stuartwider)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/adding-custom-php-code-and-tracking-codes-in-footer/#post-4147684)
 * If your custom php file needs to be executed in the footer the you could place
   it render.php around here…
 *     ```
       print '<!-- wp_footer() -->' . HMTA_NL;
       wp_footer();
       print '<!-- End of wp_footer() -->' . HMTA_NL;
       ```
   
 *  Thread Starter [avil](https://wordpress.org/support/users/avil/)
 * (@avil)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/adding-custom-php-code-and-tracking-codes-in-footer/#post-4147686)
 * Thanks a lot that worked.
 * How about the sidebars if I want to place custom code or call a php function 
   of a plugin ?
 *  Theme Author [heatmap](https://wordpress.org/support/users/stuartwider/)
 * (@stuartwider)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/adding-custom-php-code-and-tracking-codes-in-footer/#post-4147694)
 * same principle applies.
    Just add your call whereever you need it in render.php.
   Look closely and you should be able to see what goes where – including the div
   structure for the sidebars.
 * Alternatively if you know how to use hooks you can just hook your functions into
   the theme templates wherever you like.
 * just take a close look at the theme templates and it should be fairly clear what
   to do.
 * In this theme, the templates attach functions to the hooks in render.php, then
   render.php runs last and executes all the functions you hooked in the templates.
 * If you are not familiar with hooks just look up add_action() in the wordpress
   codex. That should make it clearer how it works.
 *  Thread Starter [avil](https://wordpress.org/support/users/avil/)
 * (@avil)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/adding-custom-php-code-and-tracking-codes-in-footer/#post-4147711)
 * Thanks Stuart, understood 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Adding custom PHP code and tracking codes in footer ?’ is closed to new
replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/heatmap-adaptive/1.5.3/screenshot.
   png)
 * HeatMap AdAptive
 * [Support Threads](https://wordpress.org/support/theme/heatmap-adaptive/)
 * [Active Topics](https://wordpress.org/support/theme/heatmap-adaptive/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/heatmap-adaptive/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/heatmap-adaptive/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [avil](https://wordpress.org/support/users/avil/)
 * Last activity: [12 years, 8 months ago](https://wordpress.org/support/topic/adding-custom-php-code-and-tracking-codes-in-footer/#post-4147711)
 * Status: resolved