WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Adsense into Header (13 posts)

  1. samsnb
    Member
    Posted 2 years ago #

    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

  2. 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.

  3. samsnb
    Member
    Posted 2 years ago #

    Hi Alchymyth

    Thanks for replying.

    All good so far.

    The site is Take Home Pay Calculator.

    Thanks

    Sam

  4. samsnb
    Member
    Posted 2 years ago #

    Hi

    I have managed to remove the search bar but I am unable to change it to adsense.

    Can anyone assist please?

    Thanks

    Sam

  5. udaraaka
    Member
    Posted 2 years ago #

    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.

  6. samsnb
    Member
    Posted 2 years ago #

    Hi Udaraaka

    Thanks for your reply.

    If I change that code it appears as follows Take Home Pay Calculator

    As opposed to within the blue header in the top right.

    Thanks for your help so far.

    Sam

  7. udaraaka
    Member
    Posted 2 years ago #

    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

  8. samsnb
    Member
    Posted 2 years ago #

    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

    It is already so much better than before.

    Thanks

    Sam

  9. udaraaka
    Member
    Posted 2 years ago #

    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?

  10. samsnb
    Member
    Posted 2 years ago #

    Hi

    Yes, same position in on the right but just up level with the title.

    Thanks for your help.

    Sam

  11. udaraaka
    Member
    Posted 2 years ago #

    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;">
  12. samsnb
    Member
    Posted 2 years ago #

    That is absolutely perfect.

    Thank you very much for your help.

  13. udaraaka
    Member
    Posted 2 years ago #

    You are welcome.

Topic Closed

This topic has been closed to new replies.

About this Topic