Title: Adsense into Header
Last modified: August 20, 2016

---

# Adsense into Header

 *  Resolved [samsnb](https://wordpress.org/support/users/samsnb/)
 * (@samsnb)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/adsense-into-header/)
 * Hi
 * I am trying to put adsense (horizontal banner) into the top right of my header.
 * The theme I am using is Andyblue. There is already a search bar there, I would
   like to replace this with adsense.
 * I am tried a number of different variations of my limited code knowledge and 
   can’t get any of them to work. Any help would be greatly appreciated.
 * The header code is as follows:
 *     ```
       <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   
               "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
   
       <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
   
         <head>
   
       <?php if ( is_home() ) : ?><title><?php bloginfo('name'); ?></title><meta name="keywords" content="italiasw, italia sw, www.italiasw.com, recensioni, web2, web 2, apps, applicativi, software, windows, windows xp, windows vista, vista, ict, recensioni ict, recensioni software, news, news high tech, blog italia, blog software, italia software, sw, blog informatica, news informatica, articoli informatica, recensioni web 2.0" /><meta name="description" content="<?php bloginfo('description'); ?>" />
   
       <?php endif ;?><?php if ( is_single()) { ?><title><?php the_title(); ?> » <?php bloginfo('name'); ?></title><?php } ?>
   
       <?php if ( is_search()) { ?><title>Search Result</title><?php } ?><?php if ( is_archive()) { ?><title><?php single_cat_title(); ?> » <?php bloginfo('name'); ?></title><?php } ?>
   
       <?php if ( is_page()) { ?><title><?php the_title(); ?> » <?php bloginfo('name'); ?></title><?php } ?><?php if ( is_404()) { ?><title>Error 404, Page not Found » <?php bloginfo('name'); ?></title><?php } ?>
   
       	<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
   
       	<meta http-equiv="Content-Language" content="en-us" />
   
       	<meta http-equiv="imagetoolbar" content="no" />
   
       	<meta name="MSSmartTagsPreventParsing" content="true" />
   
       	<meta name="description" content="" />
   
       	<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
   
       	<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
   
       	<link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
   
       	<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />
           <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
           <script src="<?php bloginfo('template_directory'); ?>/js/calculations2.js" type="text/javascript"></script>
   
       	<?php wp_head(); ?>
   
       <script type="text/javascript">
   
         var _gaq = _gaq || [];
         _gaq.push(['_setAccount', 'UA-33789199-1']);
         _gaq.push(['_trackPageview']);
   
         (function() {
           var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
           ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
           var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
         })();
   
       </script></head>
   
       <body>
   
       	<div id="header">
   
       	<h1><a></a><a>/"><?php bloginfo('name'); ?></a></h1>
   
       	<h2><?php bloginfo('description'); ?></h2>
   
       				<?php include (TEMPLATEPATH . '/searchform.php'); ?></div>
   
       <div <script type="text/javascript"><!--
       google_ad_client = "ca-pub-1236697108641913";
       /* THOC Header */
       google_ad_slot = "2441790312";
       google_ad_width = 468;
       google_ad_height = 60;
       //-->
       </script>
       <script type="text/javascript"
       src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
       </script>
       </div>
       ```
   
 * Thanks for your help.
 * Sam

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

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/adsense-into-header/#post-2981356)
 * to get rid of the searchbar, remove this:
 * `<?php include (TEMPLATEPATH . '/searchform.php'); ?>`
 * and repair this line:
 *     ```
       <div <script type="text/javascript"><!--
       ```
   
 * to:
 *     ```
       <div> <script type="text/javascript"><!--
       ```
   
 * there might be other problems with the formatting – to illustrate what is going
   wrong, please post a link to your site.
 *  Thread Starter [samsnb](https://wordpress.org/support/users/samsnb/)
 * (@samsnb)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/adsense-into-header/#post-2981359)
 * Hi Alchymyth
 * Thanks for replying.
 * All good so far.
 * The site is [Take Home Pay Calculator](http://www.take-home-paycalculator.com/).
 * Thanks
 * Sam
 *  Thread Starter [samsnb](https://wordpress.org/support/users/samsnb/)
 * (@samsnb)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/adsense-into-header/#post-2981513)
 * Hi
 * I have managed to remove the search bar but I am unable to change it to adsense.
 * Can anyone assist please?
 * Thanks
 * Sam
 *  [udaraaka](https://wordpress.org/support/users/udaraaka/)
 * (@udaraaka)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/adsense-into-header/#post-2981517)
 * If you have removed that search part now your code appear as follows
 *     ```
       <h2><?php bloginfo('description'); ?></h2>
   
       				</div>
       ```
   
 * Just put your adsense code between </h2> and </div>
 * That’s all.
 *  Thread Starter [samsnb](https://wordpress.org/support/users/samsnb/)
 * (@samsnb)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/adsense-into-header/#post-2981518)
 * Hi Udaraaka
 * Thanks for your reply.
 * If I change that code it appears as follows [Take Home Pay Calculator](http://www.take-home-paycalculator.com)
 * As opposed to within the blue header in the top right.
 * Thanks for your help so far.
 * Sam
 *  [udaraaka](https://wordpress.org/support/users/udaraaka/)
 * (@udaraaka)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/adsense-into-header/#post-2981523)
 * Ok, first put the following code between </h2> and </div> instead of adsense 
   code
 *     ```
       <div style="height:60px; width:100%; background-color:#467AA7"><div style="height:60px; width:500px; float:right;">
   
       </div></div>
       ```
   
 * Then put the adsense code between float:right;”> and </div></div>
 * Remember you have to adjust height of both divs(60px) acourding to adsense ad
   height and width of the second inner div(500px) to fit with adsense ad width
 * Let me know if there are any problems
 *  Thread Starter [samsnb](https://wordpress.org/support/users/samsnb/)
 * (@samsnb)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/adsense-into-header/#post-2981524)
 * Thanks very much for that.
 * It is working now within the header, is it possible to move it to the top now
   as oppose to the bottom of the header? [Take Home Pay Calculator](http://www.take-home-paycalculator.com)
 * It is already so much better than before.
 * Thanks
 * Sam
 *  [udaraaka](https://wordpress.org/support/users/udaraaka/)
 * (@udaraaka)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/adsense-into-header/#post-2981525)
 * What do you mean by move it to the top? you mean right side of the
    Take Home
   Pay Calculator Calculate your take home pay in seconds text?
 *  Thread Starter [samsnb](https://wordpress.org/support/users/samsnb/)
 * (@samsnb)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/adsense-into-header/#post-2981527)
 * Hi
 * Yes, same position in on the right but just up level with the title.
 * Thanks for your help.
 * Sam
 *  [udaraaka](https://wordpress.org/support/users/udaraaka/)
 * (@udaraaka)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/adsense-into-header/#post-2981534)
 * replace the current content between <div id=”header”> and your adsense code with
   the following code
 *     ```
       <div style="height:60px; background-color:#467AA7; float:left"><h1><a></a><a href="http://www.take-home-paycalculator.com/">Take Home Pay Calculator</a></h1>
   
       	<h2>Calculate your take home pay in seconds.</h2></div>
   
       <div style="height:100px; width:100%; background-color:#467AA7"><div style="height:60px; width:500px; float:right;">
       ```
   
 *  Thread Starter [samsnb](https://wordpress.org/support/users/samsnb/)
 * (@samsnb)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/adsense-into-header/#post-2981536)
 * That is absolutely perfect.
 * Thank you very much for your help.
 *  [udaraaka](https://wordpress.org/support/users/udaraaka/)
 * (@udaraaka)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/adsense-into-header/#post-2981537)
 * You are welcome.

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

The topic ‘Adsense into Header’ is closed to new replies.

## Tags

 * [COD](https://wordpress.org/support/topic-tag/cod/)
 * [header](https://wordpress.org/support/topic-tag/header/)

 * 12 replies
 * 3 participants
 * Last reply from: [udaraaka](https://wordpress.org/support/users/udaraaka/)
 * Last activity: [13 years, 9 months ago](https://wordpress.org/support/topic/adsense-into-header/#post-2981537)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
