- This topic has 9 replies, 2 voices, and was last updated 1 year, 7 months ago by
David.
-
AuthorPosts
-
August 2, 2019 at 10:25 am #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 bannerAugust 2, 2019 at 10:37 am #974210David
StaffCustomer SupportHi there,
you would need to set that up within the Adsense advert itself – there should be responsive options.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/August 2, 2019 at 10:54 am #974223Immi
Hello, David sir I have selected responsive in Adsense but still showing bigger.
it’s possible to make smaller by CSS code for mobile devicesAugust 2, 2019 at 10:55 am #974224David
StaffCustomer SupportCould you link me to a post where i can see the Advert?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/August 2, 2019 at 11:07 am #974233Immi
August 2, 2019 at 11:18 am #974241David
StaffCustomer SupportThere 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.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/August 2, 2019 at 11:31 am #974253Immi
Sir, I have placed this code in GP hook-like this:
can you have a look this is ok<?php if ( is_page() || is_single() ) : ?>
<script async src=”https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script>
<!– Header add –>
<ins class=”adsbygoogle”
style=”display:block”
data-ad-client=”ca-pub-7341502470185310″
data-ad-slot=”9397554313″
data-ad-format=”auto”
data-full-width-responsive=”true”></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><?php endif; ?>
August 2, 2019 at 11:34 am #974254David
StaffCustomer SupportThat 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
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/August 3, 2019 at 11:05 am #974943Immi
Thank You David Sir,
August 3, 2019 at 2:32 pm #975023David
StaffCustomer SupportYou’re welcome
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.