The old code snippet from BuySellAds.com didn’t require to change anything in the code of a site/blog; only to be copypasted into a text widget was the deal. The new code is much better as it is not blocking the rest of the page while it’s loading, but you have to put a code snippet right after the opening <body> tag on all pages. In Thematic, this can be easily accomplished without any plugins or theme file hacks, just paste this into the functions.php of your child theme:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <?php function bsa_before() { ?> <!-- BuySellAds.com Ad Code --> <script type="text/javascript"> (function(){ var bsa = document.createElement('script'); bsa.type = 'text/javascript'; bsa.async = true; bsa.src = '//s3.buysellads.com/ac/bsa.js'; (document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(bsa); })(); </script> <!-- END BuySellAds.com Ad Code --> <?php } add_action('thematic_before', 'bsa_before'); ?> |
Then you can put the actual ad slot code from the ‘Get ad code’ page into a text widget in your sidebar, or any other place as you wish.


2 Comments
Simple but very useful! Thanks Eugen.
You’re welcome!