WordPress.org

Ready to get started?Download WordPress

Forums

HeatMap AdAptive
[resolved] Adding custom PHP code and tracking codes in footer ? (5 posts)

  1. avil
    Member
    Posted 9 months ago #

    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.

  2. stuartwider
    Member
    Theme Author

    Posted 9 months ago #

    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;
  3. avil
    Member
    Posted 9 months ago #

    Thanks a lot that worked.

    How about the sidebars if I want to place custom code or call a php function of a plugin ?

  4. stuartwider
    Member
    Theme Author

    Posted 9 months ago #

    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.

  5. avil
    Member
    Posted 9 months ago #

    Thanks Stuart, understood :)

Reply

You must log in to post.

About this Theme

About this Topic

Tags

No tags yet.