if you are open to using a plugin then I can suggest Advanced Ads. Disclaimer: I developed it.
After you activated the plugin, just go to Advanced Ads > Settings > AdSense, type in the publisher ID (from the activation code) and enable the “Page-Level Ads” option.
The AdSense activation code should then be added automatically at the right place.
Thomas
]]>Otherwise you can add it manually anywhere you want by inserting ONE time in header:
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
Open tools>>editor and find header.php file and add before </head>
and add the rest of the adsense code anywhere you want like widget or template files:
<!-- MY-SITE-ADS RESPONSIVE -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-1111111111111111"
data-ad-slot="111111111111111"
data-ad-format="vertical"</ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
Use responsive ads to adjust to all sizes automatically.
If you want to use specific sizes with responsive ads just add this before the code:
<div class="ads_2">
<style type="text/css">
.adslot_2 { width: 120px; height: 240px; }
@media (min-width:500px) { .adslot_2 { width: 120px; height: 600px; } }
@media (min-width:800px) { .adslot_2 { width: 160px; height: 600px; } }
@media (min-width:1000px) { .adslot_2 { width: 300px; height: 1050px; } }
</style>
--- GOOGLE ADSENSE CODE ---
</div>
]]>
host: your-site-.com
username: your-hosting-username
password: your-hosting-password
Find all your website files and structure in public_html, look for wp-content/themes/your-theme-name/header.php
]]>