Support » Theme: Twenty Twelve » Google ad in header area?

  • Hello everyone,

    I really like the theme and would like to add a banner (banner 468 x 60) on the empty right side next to the page title.

    Is this possible and what needs to be done?

    Many thanks

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator Andrew Nevins


    Forum moderator

    Have you created a Child Theme of Twenty Twelve?

    No, do I need to and how to?

    Moderator Andrew Nevins


    Forum moderator

    You’ll need to make some HTML modifications, so yes, you’ll need a Child Theme. Here’s the official guide on them

    ok, thank you and sorry for the basic question.

    How do I include the google code then?

    Moderator Andrew Nevins


    Forum moderator

    You copy & paste the header.php file into your Child Theme directory (where the style.css file is) and then modify that to hold your Google Ad code.



    Forum Moderator

    edit header.php in the child theme;

    add for instance this code before <hgroup>:

    <div class="header-ads">
    <script type="text/javascript"><!--
    google_ad_client = "pub-0123456789012";
    /* your adsense */
    google_ad_slot = "1234567890";
    google_ad_width = 468;
    google_ad_height = 60;
    <script type="text/javascript"
    </div><!--/ .header-ads -->

    all adsense formatting is a compromise in a responsive theme;
    add for instance this css to the style.css in the child theme:

    .site-header { position: relative; padding-top: 100px; }
    .header-ads { position: absolute; left: auto; top: 30px; width: 100%; text-align: center; }
    @media screen and (min-width: 600px) {
    	.site-header { position: relative; padding-top: 1.71429rem; }
    	.header-ads { position: absolute; left: auto; right: 0; top: 30px; text-align: right; max-width: 70%; }

    clear the browser cache so you can see the changes immediately; press ‘ctrl f5’ or ‘reload’ or ….

    Dear Alchymyth,

    it worked out perfectly now – many thanks for the great help 🙂

    Many regards

    Hi again Alchymyth,

    can you post here some css adjustments for including 728 x 90 leaderboard into the header area?

    Many thanks,

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Google ad in header area?’ is closed to new replies.