Title: Adding Javascript ad code from ad network
Last modified: August 19, 2016

---

# Adding Javascript ad code from ad network

 *  [D.Duggs](https://wordpress.org/support/users/dduggs/)
 * (@dduggs)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/adding-javascript-ad-code-from-ad-network/)
 * Please help! I have tried everything to add a javascript ad code to my header
   and side bar and nothing is working. I put the code in the header.php and sidebar.
   php files and when I go to the site all that shows up in its place is “‘)” I 
   tested the code and it works fine in the preview of the Javascript/HTML widget,
   but when I save, it doesn’t appear on my website.
    [http://www.sportsandalatte.com](http://www.sportsandalatte.com)
 * Please help me!
 * The ad code [header]
 * <!– begin 160×600 Top Sports and a Latte –>
    <script language=”JavaScript” type
   =”text/javascript”> window.dctile = Number(window.dctile) + 1 || 1; window.dc_ord
   = Number(window.dc_ord) || Math.floor(Math.random() * 1E10); if (dctile==1) {
   var vdcopt = ‘ist’;} else {vdcopt = ”;} if (17>dctile) document.write(‘<script
   type=”text/javascript” src=”[http://ad.doubleclick.net/adj/yb.sportsandalatte/;chan1=gensports;rating=pg;dcopt=&#8217](http://ad.doubleclick.net/adj/yb.sportsandalatte/;chan1=gensports;rating=pg;dcopt=&#8217);
   + vdcopt + ‘;yb=ad;s1=;s2=;tile=’ + dctile + ‘;sz=160×600;ord=’ + dc_ord + ‘?”
   ><\/script>\n’); </script> <!– End ad tag –>

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

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/adding-javascript-ad-code-from-ad-network/#post-1754227)
 * [http://codex.wordpress.org/Using_Javascript](http://codex.wordpress.org/Using_Javascript)
   
   [http://codex.wordpress.org/Function_Reference/wp_enqueue_script](http://codex.wordpress.org/Function_Reference/wp_enqueue_script)
 *  Thread Starter [D.Duggs](https://wordpress.org/support/users/dduggs/)
 * (@dduggs)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/adding-javascript-ad-code-from-ad-network/#post-1754336)
 * Thank you, but I am not a developer and I really don’t understand what I’m supposed
   to do. I’ve tried to follow those, but I don’t get it.
 * If any one can tell me where I’m supposed to paste the ad code, that would be
   great.
 * With this line,
    <script type=”text/javascript” src=”<?php bloginfo(‘template_url’);?
   >/pathto/yourscript.js”></script>
 * Am I supposed to replace “yourscript.js” with something from the ad code?
 *  [govpatel](https://wordpress.org/support/users/govpatel/)
 * (@govpatel)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/adding-javascript-ad-code-from-ad-network/#post-1754337)
 * looked at your where are going to add your ad in header as there not much room
   for ad 160 by 600
 *  Thread Starter [D.Duggs](https://wordpress.org/support/users/dduggs/)
 * (@dduggs)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/adding-javascript-ad-code-from-ad-network/#post-1754339)
 * I plan to remove most of the stuff on my sidebar.
 * I have the code for a banner ad in the header, a sky scraper on the sidebar and
   a box/rectangle for the sidebar.
 * I just need one to successfully show and I don’t know where to paste the code
   for the sidebar.
 *  [govpatel](https://wordpress.org/support/users/govpatel/)
 * (@govpatel)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/adding-javascript-ad-code-from-ad-network/#post-1754347)
 * try using the text widget for side bar
 *  Thread Starter [D.Duggs](https://wordpress.org/support/users/dduggs/)
 * (@dduggs)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/adding-javascript-ad-code-from-ad-network/#post-1754352)
 * I tried that as well and it doesn’t work.
 * I don’t know if I’m missing something in the code or what.
 *  [govpatel](https://wordpress.org/support/users/govpatel/)
 * (@govpatel)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/adding-javascript-ad-code-from-ad-network/#post-1754353)
 * Ijust put same code you have on my test wordpress using text widget and is working
   fine check it out
 * [http://govpatel.com/wordpress](http://govpatel.com/wordpress)
 *  Thread Starter [D.Duggs](https://wordpress.org/support/users/dduggs/)
 * (@dduggs)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/adding-javascript-ad-code-from-ad-network/#post-1754354)
 * wow, hmmm wonder why it’s not working for me. Perhaps it’s the theme I’m using?
   Would that be an issue?
 *  Thread Starter [D.Duggs](https://wordpress.org/support/users/dduggs/)
 * (@dduggs)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/adding-javascript-ad-code-from-ad-network/#post-1754355)
 * Problem Solved, it was my theme 🙁
 * I really liked the theme I was using… wonder how I could work around this issue.
 * Thanks everyone

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

The topic ‘Adding Javascript ad code from ad network’ is closed to new replies.

## Tags

 * [ad code](https://wordpress.org/support/topic-tag/ad-code/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 9 replies
 * 3 participants
 * Last reply from: [D.Duggs](https://wordpress.org/support/users/dduggs/)
 * Last activity: [15 years, 7 months ago](https://wordpress.org/support/topic/adding-javascript-ad-code-from-ad-network/#post-1754355)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
