WordPress.org

Ready to get started?Download WordPress

Forums

Twenty Twelve
Google ad in header area? (9 posts)

  1. etheme
    Member
    Posted 1 year ago #

    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

  2. Andrew
    Forum Moderator
    Posted 1 year ago #

    Have you created a Child Theme of Twenty Twelve?

  3. etheme
    Member
    Posted 1 year ago #

    No, do I need to and how to?

  4. Andrew
    Forum Moderator
    Posted 1 year ago #

    You'll need to make some HTML modifications, so yes, you'll need a Child Theme. Here's the official guide on them http://codex.wordpress.org/Child_Themes#Example_of_a_basic_Child_Theme

  5. etheme
    Member
    Posted 1 year ago #

    ok, thank you and sorry for the basic question.

    How do I include the google code then?

  6. Andrew
    Forum Moderator
    Posted 1 year ago #

    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.

  7. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    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>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    </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 ....

  8. etheme
    Member
    Posted 1 year ago #

    Dear Alchymyth,

    it worked out perfectly now - many thanks for the great help :-)

    Many regards

  9. mik-ost
    Member
    Posted 1 year ago #

    Hi again Alchymyth,

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

    Many thanks,
    Mike

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic