[Resolved] adsense code with hooks

Home Forums Support [Resolved] adsense code with hooks

Home Forums Support adsense code with hooks

  • This topic has 9 replies, 2 voices, and was last updated 2 years ago by David.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #974196
    Immi

    I’m using Adsense banner with GP hooks at Before Content.
    The ad appears large in mobile devices. I want to display it small for mobile devices. The desktop view appears, ok.
    can you provide me CSS code for smaller ad banner

    #974210
    David
    Staff
    Customer Support

    Hi there,

    you would need to set that up within the Adsense advert itself – there should be responsive options.

    #974223
    Immi

    Hello, David sir I have selected responsive in Adsense but still showing bigger.
    it’s possible to make smaller by CSS code for mobile devices

    #974224
    David
    Staff
    Customer Support

    Could you link me to a post where i can see the Advert?

    #974233
    Immi

    **

    yes, Sir,

    I have attached a screenshot.
    **

    #974241
    David
    Staff
    Customer Support

    There isn’t much we can do about this – Adsense detects the size of the device and serves up a file to fit that size.

    The most we can try is to wrap the Adsense code inside a div with a CSS class that we can set the width of:

    <div class="ad-container">
    Your adsence code here
    </div>

    Then this CSS which will ad some left and right padding on mobile to reduce the content width available:

    @media (max-width: 768px) {
        .ad-container {
            padding: 0 30px;
        }
    }

    Not sure if it will help but thats about as much you can do – you cannot style content using CSS that comes from a 3rd party server.

    #974253
    Immi

    Sir, I have placed this code in GP hook-like this:
    can you have a look this is ok

    **

    #974254
    David
    Staff
    Customer Support

    That is correct – although if you want you can remove the if conditional ie.

    <?php if ( is_page() || is_single() ) : ?> …. <?php endif; ?>

    And use the Display Rules in the Hook Element to set it to display on Pages and Posts

    #974943
    Immi

    Thank You David Sir,

    #975023
    David
    Staff
    Customer Support
Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.