Integrate Google Adsense with the Fresh News Theme Sidebar Ad

I use the Fresh News Theme by WooThemes for the overall look and feel ofHandyManHowTo.com.  Several people have asked me “How did you integrate Google Adsense into the Fresh News Theme 300×250 Block Ad in the Sidebar?“. An example is the “Zoom Plumbing” Google Ad in the screen grab below.

test

test

  1. Log into your Google Adsense account.
  2. Create a text and image, square, “300×250 Medium Rectangle Ad”.
  3. Copy and save the AdSense Unit Code. The code for my 300×250 ad is:

<script type=”text/javascript”><!–
google_ad_client = “pub-2484226848394294?;
/* 300×250, created 10/11/08 */
google_ad_slot = “9756119931?;
google_ad_width = 300;
google_ad_height = 250;
//–>
</script>
<script type=”text/javascript”
src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”>
</script>

Edit  ads-300×250.php

WooThemes executes the PHP code in the ads-300×250.php file to paint the content of the 300×250 pixel block ad in the sidebar. The file is located in the

/public_html/wp-content/themes/freshnews/ads

directory on your website.

  1. Make a backup copy of the ads-300×250.php
  2. Edit ads-300×250.php
  3. Replace the content of the <div id=”mpu_banner”> …. </div>
    in both places of the file with your Adsense Unit Code.

Original Code Block

<div class=”box2?>

<div id=”mpu_banner”>

<?php

// Get block code //
$block_img = get_option(’woo_block_image’);
$block_url = get_option(’woo_block_url’);

?>

<a <?php do_action(’woo_external_ad_link’); ?> href=”<?php echo “$block_url”; ?>”><img src=”<?php echo “$block_img”; ?>” alt=”” /></a>

</div>

</div>

Google Adsense Code Block

<div class=”box2?>

<div id=”mpu_banner”>

<script type=”text/javascript”><!–
google_ad_client = “pub-2484226848394294?;
/* 300×250, created 10/11/08 */
google_ad_slot = “9756119931?;
google_ad_width = 300;
google_ad_height = 250;
//–>
</script>
<script type=”text/javascript”
src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”>
</script>

</div>

</div>

The original and changed source files are here for comparison. I’ve renamed the files to a .txt extension to prevent WordPress from executing the files when clicking on the links.

Default theme file: ads-300×250-original.php

Google Adsense file: ads-300×250.php

Good luck with your website!


Related posts:

  1. Ultimate Google AdSense : Tools, Tips and Resources
  2. Earn More From AdSense By Improving Performance of Link Units
  3. Google 3D Debut on Internet
  4. Google Friend Connect (Hot)
  5. Complete Guide to Make You Google Chrome Expert

Looking for something else?

Subscribe to our feeds via email.

(Dont worry we hate spam too!)

Enter your email address:

Delivered by FeedBurner

About inAm
Hi, my name is inAm, i am a tech-blogger and currently pursuing my degree in Software Engineering. I started blogging just for fun of being part of larger blogging community with similar interests but with time i have now developed addiction to it. I started Tempting Magazine in February 2009 and in just first two months my blog jumped to a Page Rank 3. If you like my posts please show some love by bookmarking them.

Leave a Reply

About Me:

Sponsors

Search

Join My Community

Advertisement

Tempting Magazine on Facebook

Earn Blogging

Find Freelance Work Here

Powered by

Links

Computers/Tech blogs TopOfBlogs Internet http://www.wikio.com Tempting Magazine - Blogged