Site logo

Archived topic

how to add auto ads from adsense in theme

14 replies · Started by jaya swaroop on February 27, 2018

Viewing posts 1–15 of 15

i like to add auto ads from adsense to our theme
please help me to resolve

nothing was changed in my website
resolve my problem

Where and what was the code you've added?

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "ca-pub-xxxxxxxxxxxx",
enable_page_level_ads: true
});
</script>

i added the code in wp_head

Hello leo
generatepress theme will support autoads or not

hello leo i added in the same part wp_head no improvements

jaya -

Where are you wanting the ads to appear?

For example, if you want them to appear in a sidebar, then add an HTML widget to the sidebar location and paste the AdSense code into it and Save.

Or, if you want to have the ad appear at the top of the page, add the code to the Before Header GP Hook location.

You can also get fancy and use PHP to conditionally display the ads in the various GP Hooks locations. On one of my sites, I have it set to display the ad only on single posts and below the content.

This is what I do on all of my sites that have Google AdSense ads :)

Cheers!
Lyle

Lyle, thanks a lot for the tips! I have already ads running on my blog, by this moment there are maximum 2 appearing per page https://www.karikfood.com
and I tried your first suggestion in order to add extra ads (this time Auto Ads), adding HTML widget on sidebar area, but it seems it doesnt work. Did I make something wrong? Maybe it is not compatible with already existing ads or plugin (WP QUADS - Quick AdSense).

You got a few console errors coming from the ads which I believe is causing them not showing:
http://www.screencast.com/t/8W7MnOni3

Might be worth checking with the source of wherever you got the code/ads.

Leo, thanks for your swift reply. Don´t understand well what exactly I have to do. Will I quit that HTML widget area with the code within put in the sidebar?

Have these methods changed, in the age of Elements if you will?
That is, having installed Elements, how might I add adsense auto ads?
The Code Snippets plugin seemed to crash my site.
Thanks

This archived topic is closed to new replies.