techxplore blog
26 Jul

Adding Adsense Link Unit In Header Of WordPress Theme

The header file is header.php, the footer file is footer.php and the content file is index.php. The simplest of themes in WordPress have the index.php including the header.php and the footer.php files. It would look like this:

<?php get_header(); ?>
<?php get_footer(); ?>

In between the header and the footer is the content. Customizing the header of the WordPress Theme and put a google adsense link unit is done by editing header.php file. It is very easy and I assure you that you’ll never use your acne cream on this. This is simple and straight forward. One can finish it in no time at all.

Just open header.php and

<div id=”header”>
<div id=”headerimg”>
<h1><a href=”<?php echo get_option(‘home’); ?>/”><?php bloginfo(‘name’); ?></a></h1>
<div class=”description”>
<?php bloginfo(‘description’); ?>
</div>
</div>
</div>

You could change the file by inserting after the headerimg div id into.

<div id=”header”>
<div id=”headerimg”>
<h1><a href=”<?php echo get_option(‘home’); ?>/”><?php bloginfo(‘name’); ?></a></h1>
<div class=”description”>
<?php bloginfo(‘description’); ?>
</div>
</div>
<div style=”position:relative; float:left; z-index:98; left: 5px; top: 15px;” >
<script type=”text/javascript”><!—
google_ad_client = “pub-6209093439227788”;
google_ad_width = 468;
google_ad_height = 15;
google_ad_format = “468x15_0ads_al”;
//2007-09-14: techxplore link unit top
google_ad_channel = “471178362”;
google_color_border = “F49E0F”;
google_color_bg = “AEF727”;
google_color_link = “0000FF”;
google_color_text = “000000”;
google_color_url = “008000”;
//—>
</script>
<script type=”text/javascript” src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”>
</script>
</div>
</div>

by inserting the google adsense top link unit javascript code above you’ll get the listed header with a adsense for top link.

This might be a simplistic way of showing how to put an adsense top link on the WordPress header.php file. That’s how it’s done.

Leave a Reply