• Hi Alex,

    I have a created a new widget for the header section to display an adsense ad as per the steps you had mentioned in a previous thread.

    What i wanted to know is how am i supposed to make that header ad responsive as it appears next to the site title on bigger screens but in smaller ones the ad goes underneath the site title.

    Below is an excerpt i picked up from Google support where they describe how their ads change according to the size of its parent container.

    Automatic sizing based on the space available. To make your code simpler and save you time and effort, our responsive ad code automatically adapts the ad unit size to your page layout. We calculate the required size dynamically based on the width of the ad unit’s parent container, then determine what’s the best standard height to go with that width.

    For example, if you have a <div> with a width of 30% and you place our ad code within the <div>, then depending on the width of the user’s screen, we’ll automatically serve different ad sizes. If your page is viewed on a tablet with a width of 1024px, we’ll serve a 307×250 ad, and if it’s view on a 21″ desktop PC with a 1680px width, we’ll serve a 504×60 ad.

    Now this is the code that i have added in the header.php section of the theme

    <div style = "float: right;"><?php dynamic_sidebar('sidebar-header'); ?></div>

    As per google’s description above the size of their ad changes according to the size of the parent div, so what size according to you should i give the div element in the code above.

    Thanks,

    Nev

Viewing 4 replies - 1 through 4 (of 4 total)
  • Excellent theme! Im interested in this question also.

    It would be cool if there is ads areas in the theme. It seams adding them manually is not exactly working form me.

    If anybody still need it.

    This is what i did:

    -create new sidebar in theme options
    -add this plugin (have nothing to do with me)
    -add adsense to plugin
    -Use plugins [GARD] shortcode in text widget
    -add to child theme file
    <div class="topads"><?php dynamic_sidebar('sidebar-top-ads'); ?></div>
    -style it a bit:

    .topads {
       text-align: right;
       margin: 3px;
       padding: 3px;
    }

    Ads are now responsive.

    Also Google adsense have responsive ads but they are in beta version and they dont work for me, ads doesnt show.

    If you’ve been wondering how to easily place ads onto your
    wordpress Hueman theme, the best plugin to help you is the
    “Google Publisher Plugin” by google itself.

    You can check out my site at [irrelevant link moderated] for example.

    All the Ads there where placed by Google’s plugin.

    I Made a few changes to the Theme especially the Logo placement but
    if you like to do the same, please let me know.

    Also, the ads are automatically responsive. You don’t have to code
    anything for mobile or tablet ads.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Responsive adsense ad in the header’ is closed to new replies.