Tagged: enfold, google adsense, script, Shortcodes
-
AuthorPosts
-
January 27, 2014 at 10:05 pm #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.
January 29, 2014 at 12:35 am #216123Hi!
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,
JosueMarch 1, 2014 at 10:53 am #231024Hi, 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?
March 1, 2014 at 10:55 am #231025June 29, 2015 at 5:08 pm #465959Hello
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, 4 months ago by fundance.
June 30, 2015 at 4:26 am #466143Hey!
Should work the same if you enable Advanced Layout Builder on the Post.
Cheers!
JosueFebruary 22, 2017 at 4:46 am #750245an 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
JonFebruary 27, 2017 at 7:21 am #752170Hi,
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 -
AuthorPosts
- The topic ‘Best way to insert Adsense Code into Enfold’ is closed to new replies.