Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #215542

    Hi,

    Can you please tell me what’s the best way to insert Google Adsense code into Enfold in a way that gives you control over individual pages? I want to create distinct channels within adsense and then insert the code into specific pages.

    I have tried using some plugins – like Adsense explosion – but I found it really difficult to use.

    Thanks.

    #216123

    Hi!

    Your best bet would be to use a [shortcode], maybe this plugin will work for you: http://wordpress.org/plugins/wordpress-plugin-for-simple-google-adsense-insertion

    Best regards,
    Josue

    #231024

    Hi, so Adsense gives you 2 pieces of code when it generates a tag. One for the header and one for the body. If I put the body code into the shortcode plugin mentioned above, where do you put the header portion of the code? header.php?

    #231025

    Hi!

    Yes, you can use this function to run a shortcode in a PHP file.

    Best regards,
    Josue

    #465959

    Hello

    It’s possible to add Google adsense on the HomePage with your : < > Bloc de code
    Why the same content is not possible into posts with an enfold < > Bloc de code ??

    Thanx

    • This reply was modified 9 years, 5 months ago by fundance.
    #466143

    Hey!

    Should work the same if you enable Advanced Layout Builder on the Post.

    Cheers!
    Josue

    #750245

    an update on this as I use AdSense on a blog http://www.bigboytravel.com with Enfold which gets 600,000 monthly visitors and it works great.

    I also recommend using a series of shortcodes for your add units which you can customize on the backend functions.php quickly to change them site wide. There have been times where new versions of WordPress have blocked AdSense script and without custom shortcodes I would have had a headache.

    float right in text example with custom shortcode of wp_ad_camp_1/

    function tall_r_shortcode() {
    ?>
       <div style=" float: right; margin: 5px; ">
       <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
       <!-- 300x600 Content -->
       <ins class="adsbygoogle"
           style="display:inline-block;width:300px;height:600px"
           data-ad-client="ca-pub-3xxxxxxxxxxxxxx"
           data-ad-slot="xxxxxxxx2"></ins>
       <script>
       (adsbygoogle = window.adsbygoogle || []).push({});
       </script>
       </div>
    <?php
    }
    add_shortcode('wp_ad_camp_1', 'tall_r_shortcode');

    can center a variation easy also

    function medium_m_shortcode() {
    ?>
       <center><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
       <!-- 336x280 Content -->
       <ins class="adsbygoogle"
           style="display: block; float: center; width: 336px; height: 280px;"
           data-ad-client="ca-pub-3xxxxxxxxxxx"
           data-ad-slot="xxxxxxxxxx4"></ins>
       <script>
       (adsbygoogle = window.adsbygoogle || []).push({});
       </script></center>
    <?php
    }
    add_shortcode('wp_ad_camp_5', 'medium_m_shortcode');

    Keep in mind that if the code code is meant to by used at html or script you must open it with ?> and close it with <?php inside the function. If it is just live text fo some reason you don’t need to do that.

    Also a worth noting that doing short codes this way forces the Ad Unit to the top of the container it sits in although it does maintain it’s float, alignment, and padding. That means if you have a long article and want multiple Ads you need to break the page/content into multiple Color Sections or Grid Rows to avoid having all the Ads push to the top of the page. It’ll make sense when you try it, but is an easy fix.

    Hope that helps others
    Jon

    #752170

    Hi,

    Thank you for sharing your solution. I’m glad this will also help others :)
    To know more about enfold features please check – http://kriesi.at/documentation/enfold/
    Thank you for using Enfold :)

    Best regards,
    Vinay

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Best way to insert Adsense Code into Enfold’ is closed to new replies.