• I’ve implemented a direction that the WordPress give on it’s Using_Javacript page and it didn’t work. I thought there was something wrong with my code or page or setup or something but the direction

    To use Javascript repeatedly within your site, you can either set the call for the Javascript, or the script itself, in the head of your header.php template file, between the meta tags and the style sheet link, no differently than you would if you were using Javascript in any HTML page. To “load” the Javascript file into your site, in the head, add something like this:

    ‘<script type=”text/javascript” src=”/scripts/emailpage.js”></script>’
    is totally incorrect.

    How frustrating!

    How do we get someone to change the codex? For those who want to know, you can use this line of code.
    ‘<script type=”text/javascript” src=”<?php bloginfo(‘template_url’); ?>/js/maxrating.js”></script>’
    The “template_url” will read to the root directory of your current template and them after the closing of the php code use a forward slash/path/to/your/file.js. If your javascript file isn’t in a sub-directory and in the root all you need is the forward slash “/” and the name of the file.

    I hope this saves someone hours of frustration!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter tsalagi

    (@tsalagi)

    Correction.

    For those who want to know, you can use this line of code.
    ‘<script type=”text/javascript” src=”<?php bloginfo(‘template_url’); ?>/js/maxrating.js”></script>’

    Do not just use that line of code. Replace it with your own path and file name.

    Anyone can create an account at the codex, login, and make changes 🙂

    It is “just” a wiki, after all.

    Thread Starter tsalagi

    (@tsalagi)

    I wasn’t aware of that. Thanks for the info. I’ll get right on it.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Update the Codex-Using Javascript page’ is closed to new replies.