Forums

adding custom code (2 posts)

  1. akebe
    Member
    Posted 3 years ago #

    Hi,

    Our organization recently migrated to Word Press, and I am trying to re-integrate some javascript code that creates pop-up layers, based on the some script from Dynamic Drive (http://www.dynamicdrive.com/dynamicindex4/imagetooltip.htm).

    An example of working code exists from the archived site at http://www.cultureplacehealth.org/nr/yimby/map.htm.

    My question is: how can I access the Head section of the template? Can you point me somewhere? I am new to your platform, and just need to fix one page. Also, is there a code editor that does not add
    and <p> tags? I'm having an awful lot of trouble cutting and pasting HTML code at this point.

    Thanks

  2. Michael Fields
    Theme Wrangler
    Posted 3 years ago #

    I got a 404 on that link. A simple solution would be to add the following code to you theme's functions.php file:

    add_action( 'wp_head', 'print_my_script' );
    function print_my_script() {
      if( is_page( 14 ) ) {
        print '<script type="text/javascript"></script>';
      }
    }

    you will want to change 14 to the page ID of the page that needs the script included.

Topic Closed

This topic has been closed to new replies.

About this Topic