• Hi,

    I recently signed up with an advertising company for my WP site, and I’ve been instructed to copy and paste some of their html code ( <script type=”text/javascript” src=”link-here”></script> ) just before the </body> on my homepage.

    Can anyone please help? I’m not entirely new to wordpress but have no idea how to do this. I’m using a static page for my homepage if it’s of any importance.

    Thanks very much,

    Dominic

Viewing 1 replies (of 1 total)
  • Generally you’ll want to enqueue your javascript in the theme’s functions.php file:

    The basic way to do this is as follows:

    function load_my_js() {
        wp_register_script('myscript', 'https://www.example.com/myscript.js');
        wp_enqueue_script('myscript');
    }
    add_action('wp_enqueue_scripts', 'load_my_js');

    If you want to load the Javascript at the bottom of the page (and the above doesn’t do it), then you can try this:

    function load_my_js() {
        wp_enqueue_script('myscript', 'https://www.example.com/myscript.js', '', '', true);
    }
    add_action('wp_enqueue_scripts', 'load_my_js');
Viewing 1 replies (of 1 total)
  • The topic ‘Add HTML to WordPress homepage?’ is closed to new replies.