Title: Add javascript to wp-blog-header.php?
Last modified: August 18, 2016

---

# Add javascript to wp-blog-header.php?

 *  [tedwinters](https://wordpress.org/support/users/tedwinters/)
 * (@tedwinters)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/add-javascript-to-wp-blog-headerphp/)
 * I’d like to add a little bit of javascript (to an external counter)
 * How can I add this to be in the main site, regardless of templates?
    Thanks!
 * I tried adding it to the bottom of wp-blog-header.php before the final ?>, but
   it results in a php error… (formatting, etc)
 * <script language=”JavaScript” type=”text/javascript” src=”pphlogger.js”></script
   >
 * Thanks!!!!!!!

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

 *  Moderator [James Huff](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/add-javascript-to-wp-blog-headerphp/#post-161973)
 * Don’t add it to the header. Add it to the footer instead. Place it in footer.
   php right after the sentence or last word and before `<div id="footer">` closes.
 *  Thread Starter [tedwinters](https://wordpress.org/support/users/tedwinters/)
 * (@tedwinters)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/add-javascript-to-wp-blog-headerphp/#post-161978)
 * Thanks, it works in the footer, but is there a way to add it to all themes, without
   editing the footer for each?
    thanks again for your help!
 *  Moderator [James Huff](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/add-javascript-to-wp-blog-headerphp/#post-161992)
 * > … but is there a way to add it to all themes, without editing the footer for
   > each?
 * Unfortunately, no. You could use a plugin instead, like BAStats.
 * [http://www.asymptomatic.net/archives/2005/02/14/1307/ba-stats/](http://www.asymptomatic.net/archives/2005/02/14/1307/ba-stats/)
   
   Download: [http://asymptomatic.net/wp-hacks](http://asymptomatic.net/wp-hacks)

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

The topic ‘Add javascript to wp-blog-header.php?’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [James Huff](https://wordpress.org/support/users/macmanx/)
 * Last activity: [21 years, 2 months ago](https://wordpress.org/support/topic/add-javascript-to-wp-blog-headerphp/#post-161992)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
