@wikijunction have you actually checked the example code given in the description section of the plugin? Please look at it closely. there it has been written as $adCode
not just adCode
. Also, you haven’t closed the div of aicp
before returning the ad code.
Please check the example code first then make your edits on that. Also when editing code, either use a code editor or simply notepad. I’m adding the example code below again:
add_shortcode( 'your_shortcode_name', function() {
if( aicp_can_see_ads() ) { // This part will show ads to your non-banned visitors
$adCode = '<div class="aicp"><!-- Don\'t forget to add this div with aicp class -->
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- AdSense Responsive Ad Code -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-1234567890"
data-ad-slot="0987654321"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div><!-- end of the aicp div -->';
return $adCode;
} else { // Anything within this part will be shown to your banned visitors or to the blocked country visitors
return '<div class="error">You have been blocked from seeing ads.</div>';
}
} );