• Resolved D4BV2

    (@d4bv2)


    Hi

    I’ve followed the video but I can’t get it working on my site ??

    At the bottom of functions.php I have this code:

    add_shortcode( ‘testingad’, function() {
    if( aicp_can_see_ads() ) {
    return “<div class=”aicp”>
    <script async src=”https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script&gt;
    <!– AdSense Responsive Ad Code –>
    <ins class=”adsbygoogle”
    style=”display:block”
    data-ad-client=”ca-pub-1810522113508002″
    data-ad-slot=”2367636574″
    data-ad-format=”auto”>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    </div>
    }
    } );

    Then on the page where the ad displays, I have this:

    <div class=”aicp”>
    if( aicp_can_see_ads() ) {
    <center><script async src=”//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script>
    <!– Leaderboard –>
    <ins class=”adsbygoogle”
    style=”display:inline-block;width:728px;height:90px”
    data-ad-client=”ca-pub-1810522113508002″
    data-ad-slot=”2367636574″>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script></center>
    }
    </div>

    What am I doing wrong? Thanks

    • This topic was modified 7 years, 8 months ago by D4BV2.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author iSaumya

    (@isaumya)

    You don’t need this:

    <div class=”aicp”>
    if( aicp_can_see_ads() ) {
    <center><script async src=”//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script>
    <!– Leaderboard –>
    <ins class=”adsbygoogle”
    style=”display:inline-block;width:728px;height:90px”
    data-ad-client=”ca-pub-1810522113508002″
    data-ad-slot=”2367636574″>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script></center>
    }
    </div>

    Where you are displaying the ad. You have created the shortcode to display your ads. so either show them like this [testingad] or inside php like this <?php echo do_shortcode('[testingad]'); ?> More info – https://developer.www.ads-software.com/reference/functions/do_shortcode/

    Hope this helps.

    • This reply was modified 7 years, 8 months ago by iSaumya.
    Thread Starter D4BV2

    (@d4bv2)

    Hi Saumya

    Thanks for your help. That makes sense ??

    I’ve put <?php echo do_shortcode(‘[testingad]’); ?> on the page instead of the other code.

    I think my code on the functions.php is wrong though. I’m getting lots of error lines?
    https://ibb.co/kqzDsk

    Can you see what I’ve done wrong?

    Thanks again!

    • This reply was modified 7 years, 8 months ago by D4BV2.
    Plugin Author iSaumya

    (@isaumya)

    Yes your are doing wrong. After return you should start with ' and not " and then in the end you didn’t closed the quote after the div tag and there is no semicolon at the end. Please look at the example code at the description section of the plugin.

    Thread Starter D4BV2

    (@d4bv2)

    Thanks Samuya – that has worked!

    It’s looking great now!

    I’ve set it to hide after 3 clicks, so hopefully it does! I don’t want to click my own ads so i can’t test it!

    Plugin Author iSaumya

    (@isaumya)

    No. I will also not recommend you to click on your own ad.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Installation troubles’ is closed to new replies.