• Resolved Bliss7

    (@bliss7)


    Hi,

    Can you show me the EXACT code sample so I can copy and paste into Ad Inserter?

    It is NOT clear and you only gave examples using shortcodes. But I don’t want to use shortcodes.

    I am referring specifically to the adding php code at the beginning (if, echo, else) part….there is no sample code to easily copy and paste over anywhere here. Even in your textual shortcode example on the front page here, you missed the <?php> part….it makes things confusing….

    Preferably you should make things more simple for non coders to understand, and textual examples showing the full implementation is lacking.

    It is impossible to copy and paste from your video, you see, and I find I have to watch so many times and spend a lot of time on this to catch what you said in the video.

    And btw, I am using PHP 5.6 and I do not want to show anything or any message to blocked visitors….

    Sorry to say, your tutorial is making assumptions that everyone knows PHP markup language. Unless I am wrong, the textual documentation also seems wrong as the example is lacking the beginning <?php and things must be very precise…

    Thanks

    • This topic was modified 8 years, 1 month ago by Bliss7.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author iSaumya

    (@isaumya)

    The example lacking the beginning <?php part for a reason. In most cases, if you use shortcode you will paste the code inside your functions.php file and in that file at the beginning it already has <?php, so you don’t need to rewrite it.

    In terms of textual explanation,s I don’t think you have read this support thread where I’ve textually explained how to use the plugin with Ad Inserter Plugin. Check: https://wordpress.org/support/topic/does-this-work-with-ad-inserter-plugin/

    Now coming to if you directly wanna use AICP inside your page template or something like that you can simply do the following:

    <?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 -->';
    		echo $adCode;
    	}
    ?>

    Which has been explained here: https://wordpress.org/support/topic/does-this-work-with-ad-inserter-plugin/#post-9827369

    Hope this helps.

    • This reply was modified 8 years, 1 month ago by iSaumya.
    Thread Starter Bliss7

    (@bliss7)

    Hi Saumya,

    Thanks for response.

    I had to dig into the Support threads and found this sample code, and then tried to paste this into Ad Inserter, but instead it messed up my layout….

    This is my code (I modified my Ad code) in this example but I’m sure you understand.

    <?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 -->
    <div style="margin-bottom: 20px; margin-top: 20px;"><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <!-- This is My Ad Unit -->
    <ins class="adsbygoogle"
         style="display:block"
         data-ad-client="ca-pub-123456789"
         data-ad-slot="1234567"
         data-ad-format="link"></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script></div></div>
    		</div><!-- end of the aicp div -->';
    		echo $adCode;
    	}
    ?>

    Why is it not working? It messed up my entire CSS settings and the posts became huge in size…

    I did click the PHP button on Ad Inserter before pasting it in, and the button became purple in text for the “PHP word”, should I do that or not?

    Plugin Author iSaumya

    (@isaumya)

    You have added one extra </div> in your code.

    Thread Starter Bliss7

    (@bliss7)

    Thanks! I removed the extra </div> and the Adsense ad is showing, but sometimes the Ads are not even showing at all, no matter how many times I reload the page.

    I am not sure if this is due to Adsense problem or not.

    And the Ads have this strange box now.

    http://www.imagebam.com/image/a6ca8f846902764

    Is it connected to all the PHP code or script in AICP? That seems like a lot of code to append to the Adsense ad.

    Thread Starter Bliss7

    (@bliss7)

    Ah, I see, I added an extra line to the Adsense code and messed it up.

    So you see there are many folks who are not coders…. 🙂

    It works now (I think).

    Plugin Author iSaumya

    (@isaumya)

    @bliss7 I completely understand, but as this is a bit complicated plugin you have to write custom code for it. That’s why I created video and textual tutorial for the plugin to make it as easier as possible.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Can you show the EXACT code (not using Shortcodes)’ is closed to new replies.