Implementation on Php 7
-
Please I really need help with the implementation of this plugin on my two websites running on Php 7.
I have friends who wants to use this plugin too but we are not advance in coding. Please if you can give me an exact code to past in my functions.php so I make little changes with my own ad code. I promise we will give you a positive 5-star rating, thanks.The page I need help with: [log in to see the link]
-
Hi,
This plugin has been developed with compatibility of PHP v7.1. SO, your system running in PHP v7.0 would have no problem. Also regarding how to implement it, I’ve provided code example and detailed video tutorial in the description section of this plugin. Please check: https://ww.wp.xz.cn/plugins/ad-invalid-click-protector/I used this code where I want to display ads but It shows the ad with some raw codes. Am I missing something pls?
<div class=”aicp”><!– if( aicp_can_see_ads() ) { /* <script async src=”//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script>
<!– Auto Display –>
<ins class=”adsbygoogle”
style=”display:block”
data-ad-client=”ca-pub-68998164567698645″
data-ad-slot=”4581141751″
data-ad-format=”auto”>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script> */ }</div><!– end of the aicp div –>You have to either create shortcode to show up the ads or if you are using it inside your template then directly wrap it inside a php tag
Please I might sound a bit off but please pardon me, am not very good with coding.
I added this code in my functions.php but my site goes blank so I removed it. Which code do I use in functions.php?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”>
<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>’;
}
} );Please which shortcode should I use? Your video tutorial look so tiny on my device I couldn’t see how you created the shortcode. Can you create one for me please? Thanks
Have you tried this approach:
add_shortcode( 'your_shortcode_name', 'your_shortcode_function_name' ); function your_shortcode_function_name() { 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"> <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>'; } }Thanks so much for your support. I was able to insert the code in functions.php then I changed the ad snippet. Then I guess I have to change your_shortcode_name to anything I want right? What about your_shortcode_function_name?
Yes you can change
your_shortcode_nameto whatever you want alsoyour_shortcode_function_nameto whatever you want as well. But please note thatyour_shortcode_function_namehas been mentioned twice so make sure you change it in both places.OMG! I feel so dumb right now. U put everything in front of me but I couldn’t figure it out. It works perfect when I blocked my country so I now know it should block invalid clicks because I don’t get to test my Adsense 🙂
Am giving you a good 5-star rating, you deserve more. Thanks alot.I’m glad you liked it. 🙂 Looking forward to your review. Also if you can, consider donating some amount.
The topic ‘Implementation on Php 7’ is closed to new replies.