WordPress.org

Support

Support » Plugins and Hacks » add custom javascript into head of only one page with plugin or custom field

add custom javascript into head of only one page with plugin or custom field

  • I have one page that needs some JavaScript added to the <head> tag. I don’t want it on all the pages, just this one.

    I’m not good with php or modifying the theme too much.

    I was hoping to find a reliable light weight plugin.
    I’d be open to maybe use a the custom field if that was easy to setup as well, but am not familiar with php or WordPress theme code.

    Is there simple way to add custom html inside of the <head> tag on a page by page basis?

Viewing 1 replies (of 1 total)
  • phpadam

    @phpadam

    You could add this into the header.php file. The example uses the home page. Just replace ‘home’ with whatever page you want to add the code to.

    <?php if (is_page('home') ) { ?>
    <!--home page custom JS-->
        <script type='text/javascript' src="<?php bloginfo('template_directory'); ?>/Scripts/customJS.js"></script>
    <?php } ?>

Viewing 1 replies (of 1 total)
  • The topic ‘add custom javascript into head of only one page with plugin or custom field’ is closed to new replies.
Skip to toolbar