• Resolved cjames615

    (@cjames615)


    Hi, after watching the video and carefully following all the steps for activating the AICP plugin on my website, I get a message that says my website has a critical error when I try to preview the changes. If I remove the php code and leave only the advertisement code, the critical error no longer appears. I guess the error is in the coding I did to apply AICP, but I have no idea where as I did exactly what the video showed. Is this an issue with AICP or Ad Inserter? Any suggestions? Thanks!

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

    (@isaumya)

    You made a mistake in your PHP code that’s why it was showing. Share the code you added in ad-inserter.

    Thread Starter cjames615

    (@cjames615)

    <?php
    if( aicp_can_see_ads() {
    //Shows the ad
    echo ‘<div class=”aicp”>
    <script async src=”https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script&gt;
    <!– Advertisement1 –>
    <ins class=”adsbygoogle”
    style=”display:block”
    data-ad-client=”ca-pub-4421937002885771″
    data-ad-slot=”6387092296″
    data-ad-format=”auto”
    data-full-width-responsive=”true”>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    </div>’;
    } else {
    //Shows something if the user is blocked from seeing the ads
    echo “Sorry! You are blocked from seeing ads.”
    }
    ?>

    Plugin Author iSaumya

    (@isaumya)

    Hi, as I can see you are missing a semicolon ; at the end of the echo statement in the else block of the code. Please add the semicolon and see if it fixes the issue.

    Thread Starter cjames615

    (@cjames615)

    This did not appear to fix the issue. Am I perhaps missing something else?

    Here is what I have now that I added the semicolon:

    <?php
    if( aicp_can_see_ads() {
    //Shows the ad
    echo ‘<div class=”aicp”>
    <script async src=”https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script&gt;
    <!– Advertisement1 –>
    <ins class=”adsbygoogle”
    style=”display:block”
    data-ad-client=”ca-pub-4421937002885771″
    data-ad-slot=”6387092296″
    data-ad-format=”auto”
    data-full-width-responsive=”true”>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    </div>’;
    } else {
    //Shows something if the user is blocked from seeing the ads
    echo “Sorry! You are blocked from seeing ads.”;
    }
    ?>

    Plugin Author iSaumya

    (@isaumya)

    If you are copy-pasting code, try manually deleting all the single-quote ' and double quote " and then manually enter then from the keyboard. Let me know if that fixes your issue.

    Thread Starter cjames615

    (@cjames615)

    Still doesn’t work. Hmmm….what else should I try?

    Plugin Author iSaumya

    (@isaumya)

    Check the PHP error log and share the error you are seeing.

    Thread Starter cjames615

    (@cjames615)

    Let me figure out how to do this and I’ll get back to you. Thank you!

    Thread Starter cjames615

    (@cjames615)

    So, I finally figured out that I had to manually type all of the code instead of copying and pasting it into the blocks of Ad Inserter from Notebook++. It appears to be working now! Thanks so much for your time and help!

    Plugin Author iSaumya

    (@isaumya)

    Glad to hear it. ??

    Sorry wrongly updated

    • This reply was modified 4 years, 3 months ago by palaniappan.
Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Critical Error At the End’ is closed to new replies.