WordPress.org

Ready to get started?Download WordPress

Forums

How do I wrap my ad code in a div class or id? (10 posts)

  1. Bliss07
    Member
    Posted 2 years ago #

    Hello there,

    I have added my first google advertisement on my website but I have a little problem: the ad is slightly truncated with the navigation bar. How can I align from top to bottom the ad block? (I'd like to align it with the logo)

    I am currently using an ad block of w=728 h=90 and it's placed at top part of the website, next to the logo. Here is the link of my website: http://www.nonhotv.com/

    Thanks!

  2. alchymyth
    Forum Moderator
    Posted 2 years ago #

    example:

    <div class="header-ad">
    ADCODE HERE
    </div>
  3. Bliss07
    Member
    Posted 2 years ago #

    Unfortunatelly is not working. I still see the ad truncated, moreover I have tried to follow the instructions as reported here but it is not working too.

    However here I write the steps that I have done:

    I have sourrounded the google code with: <div id="adsenseAd">...google code...</div> ;

    Then added in the style.css: #adsenseAd { margin-left: bottom; } ;

    It didn't work and I have tried another possible solution in header.php but it didn't work too:

    <div style="text-align: center;">...google ad code...</div>

    Any idea what it could be?

  4. alchymyth
    Forum Moderator
    Posted 2 years ago #

    I don't see any truncation;

    to push the ad down, try:

    #adsenseAd { padding-top: 50px; }

    adjust the number value.

    posting a screenshot of your problem might help to illustrate what you are getting in your browser.

  5. Bliss07
    Member
    Posted 2 years ago #

    Hi alchymyth,

    The ad block is not moving at all. I have tried different solutions but it remains as it is now. This is what I've done so far is (text in bold is the new code lines added):

    header.php page:

    <div id="adsenseAd"><script type="text/javascript"><!--
    google_ad_client = "ca-pub-6085820096448112";
    /* nonhoTVtop */
    google_ad_slot = "0253151975";
    google_ad_width = 728;
    google_ad_height = 90;
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script></div>

    After having added <div id="adsenseAd"> I've opened the CSS Stylesheet page and added at the botton of the CSS:

    #adsenseAd {
    padding-top: 50px;
    }

    Regarding the screenshot, I think there is no need to uploadit as I just want to push the ad down like you have said.

    Thanks!

  6. alchymyth
    Forum Moderator
    Posted 2 years ago #

    try to clear the browser cache - 'CTRL F5' or 'reload' or whatever your browser needs...

    I can't find the #adsenseAd css in your site.

  7. Bliss07
    Member
    Posted 2 years ago #

    Hi alchymyth,

    I have tried to clear the browser cache but there are no changes.

    Regarding #adsenseAd I have added it in Stylesheet (style.css) at the bottom of my theme's stylesheet (style.css). This is where I have added the value:

    [CSS code moderated - a link to your site is enough to access the styles]

    This is the very end of my stylesheet, I have also notice that there is another page called Style-black.css (style-black.css), perhaps I should make some changes there?

    Moreover I have copied the google ad code in the header page (header.php) just below the following code string:

    [code moderated - the forum limit is 10 lines - please follow the forum guidelines for posting code]

    Did I do something wrong?

    Thanks!

  8. alchymyth
    Forum Moderator
    Posted 2 years ago #

    that section at the end is only called for smaller screens;

    add the css somewhere close to the top of style.css

  9. Bliss07
    Member
    Posted 2 years ago #

    Hi alchymyth,

    My mistake was adding the value at the end of my stylesheet as you have pointed out. Moving the CSS value from the bottom to the top (headings section) it worked!

    Thanks a million!

  10. Bliss07
    Member
    Posted 2 years ago #

    Issue fixed.

Topic Closed

This topic has been closed to new replies.

About this Topic