• Resolved wikijunction

    (@wikijunction)


    add_shortcode( ‘ads1’, function() {
    if( aicp_can_see_ads() ) {
    adCode = ‘<div class=”aicp”>


    ’;
    return ‘adCode’;
    }
    } );

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author iSaumya

    (@isaumya)

    When sharing your code, wrap that inside pre tag else I can’t read it as is showing the bluehost image. Also in the description section of the plugin, it is clearly written that that latest version of the plugin doesn’t work on affiliate ad codes.

    Thread Starter wikijunction

    (@wikijunction)

    Did you mean, if I will paste the adsense code then it will not show an error?

    Plugin Author iSaumya

    (@isaumya)

    I said that please paste the code you pasted above, paste it within a pre tag so that so that I can see it. Or just remove the image url from the code otherwise its gonna look like this on my end. https://i.imgur.com/YMZlwOQ.jpg

    Thread Starter wikijunction

    (@wikijunction)

    add_shortcode( ‘ads1’, function() {
    if( aicp_can_see_ads() ) {
    adCode = ‘<div class=”aicp”>
    <……Url….>’;
    return adCode;
    }
    } );

    Plugin Author iSaumya

    (@isaumya)

    @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>';
        }
    } );
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Always get 500 error’ is closed to new replies.