so, using your second link/example, replace:
# ad code here
with
echo ' <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!– Responsive –> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-xxxxxxxxxxxxxxxx" data-ad-slot="xxxxxxxxx" data-ad-format="auto"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> ';
and you should be good to go... remember, use the raw code button to copy so your dont get dorked up quote characters... and of course, replace your adsense publisher info back in there...