Support » Plugin: Ad Invalid Click Protector (AICP) » Theme brake

  • Resolved krunal650

    (@krunal650)


    Dear sir,

    In the post-use this code as below two different abs. Then theme is a brake
    please solve this problem

    <?php 
    	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>';
    	}
    ?>

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Saumya Majumder

    (@isaumya)

    @krunal650 are you using the above code inside your theme template or via any plugin?

    Plugin Author Saumya Majumder

    (@isaumya)

    @krunal650 If you are using the above core in your theme template, then you need to use echo instead of return. So, your above code will be like this:

    <?php
    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 –>';
      echo $adCode;
    } else { // Anything within this part will be shown to your banned visitors or to the blocked country visitors
      echo '<div class="error">You have been blocked from seeing ads.</div>';
    }
    ?>
    Thread Starter krunal650

    (@krunal650)

    I am using Ad inserter plugin

    Plugin Author Saumya Majumder

    (@isaumya)

    @krunal650 then you should try using echo instead of return. Check the code snippet I’ve shared above.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Theme brake’ is closed to new replies.