Hi,
you can create as many shortcodes you want just make sure each shortcode has different name.
Ok, would I need to have a blank line between the separate shortcode instances, like this?
add_shortcode( ‘googlead1’, 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 –>
<div class=”aicp”><script async src=”//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script>
<!– Google ROS ATF Medrec –>
<ins class=”adsbygoogle”
style=”display:inline-block;width:300px;height:250px”
data-ad-client=”ca-pub-12345689123456789″
data-ad-slot=”123456789″>
<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>’;
}
} );
add_shortcode( ‘googlead2’, 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=”https://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”>
<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>’;
}
} );
Yes you need to have a blank line in between like you have but in your first ad code at the end of </script> tag there is this */ } which I think there by mistake. Remove that or else that will give you an error.
Thanks! I will fix that up before enabling it later this week.