[resolved] how to include a javascript at the end of my page through a plugin (3 posts)

  1. paamayim
    Posted 7 years ago #

    Hi all,

    I'm pretty new to WordPress but I'm learning fast.

    I wrote a plugin, and I'm calling its functions from a custom template page /testpage/.

    I need to register a function that echoes a javascript to be included at the very end of the html page, but I don't know how to do it.

    To include css files in the head I did something like this:

    function myplugin_css()
    echo '<link ..........';

    What is the equivalent I may use to print '<script ....' at the very end of the page before </body> tag?

    Thanks in advance for any help.

  2. Michael Torbert
    WordPress Virtuoso
    Posted 7 years ago #

    Take a look at add_action( 'wp_footer','function');

  3. paamayim
    Posted 7 years ago #

    Thanks, I was using a custom theme and there wasn't the wp_footer() hook, so I had to add it and now it works!

Topic Closed

This topic has been closed to new replies.

About this Topic