[resolved] How to place a google adsense banner in the header (11 posts)

  1. hanflow
    Posted 3 years ago #

    My blog: http://imperativesounds.com

    How would I go about placing a google adsense banner (728 x 90) in the header, aligned and next to the header image on the top left? Any help is appreciated.

  2. WPyogi
    Forum Moderator
    Posted 3 years ago #

    You'd need to modify the header.php file - but before doing that you'll need to create a child theme so that your changes are not overwritten when the theme is updated.

    See: http://codex.wordpress.org/Child_Themes

  3. hanflow
    Posted 3 years ago #

  4. hanflow
    Posted 2 years ago #


    I've created a child theme, by creating a new directory titled 'blaskan-child' and placing an identical copy of styles.css and functions.php in it.

    No what could I try?

  5. hanflow
    Posted 2 years ago #

    In the new css.style file..it's almost blank. it just has this:

    Theme Name:     blaskan child theme
    Description:    child theme
    Author:         HanFlow
    Template:       blaskan
    (optional values you can add: Theme URI, Author URI, Version)
    @import url("../blaskan/style.css");
  6. WPyogi
    Forum Moderator
    Posted 2 years ago #

    Yes, it will be, but at the moment you don't have a child theme active on your site. Once created, you need to activate it just like switching to any other new theme.

  7. WPyogi
    Forum Moderator
    Posted 2 years ago #

    Yes, that looks correct, try activating the child theme.

  8. hanflow
    Posted 2 years ago #

    Its activated! =]

  9. WPyogi
    Forum Moderator
    Posted 2 years ago #

    Cool - so you want the ad on the left at the very top? or where?

  10. WPyogi
    Forum Moderator
    Posted 2 years ago #

    Assuming top left - make a new file header.php in your child theme with this code in it:

    <!DOCTYPE html>
    <!--[if IEMobile 7 ]><html id="blaskan" class="no-js iem7" <?php language_attributes(); ?>><![endif]-->
    <!--[if lt IE 7 ]><html id="blaskan" class="no-js ie6" <?php language_attributes(); ?>><![endif]-->
    <!--[if IE 7 ]><html id="blaskan" class="no-js ie7" <?php language_attributes(); ?>><![endif]-->
    <!--[if IE 8 ]><html id="blaskan" class="no-js ie8" <?php language_attributes(); ?>><![endif]-->
    <!--[if IE 9 ]><html id="blaskan" class="no-js ie9" <?php language_attributes(); ?>><![endif]-->
    <!--[if (gt IE 9)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html id="blaskan" class="no-js" <?php language_attributes(); ?>><!--<![endif]-->
    	<meta charset="<?php bloginfo( 'charset' ); ?>">
    	<title><?php blaskan_head_title(); ?></title>
    	<?php wp_head(); ?>
    	<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
    <body <?php body_class(); ?>>
    <?php echo blaskan_top(); ?>
    <div id="site">
    	<div id="wrapper">
              <div id="ad">put my ad code here</div>
    		<header id="header" role="banner">
    		  <?php echo blaskan_header_structure(); ?>
    		<!-- / #header -->

    Then in your new child theme style.css file, add this:

    #ad {
       width: 728px;
       height: 90px;
       border: 2px solid red;

    Obviously, change the border or size as you wish.

  11. hanflow
    Posted 2 years ago #

    Yes, but there's a problem. It's impossible to fit a 728x90 ad with a decent sized logo image next to it, which is why I was asking how to enlarge the body width by 30~50px on my other post. I messed around yesterday and the ad and logo don't fit right, they end up being stacked on top of each other.

    Thank you for always being so responsive Yogi.

    Update: Please check out the site now and see what I mean.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.