Support Forum

Any thoughts for a advertisement plugin?

< 1 2 3 >
Mr Papa
Simi Valley, CA
Member
Free Members
Oct 19, 2014 - 8:27 pm

so, using your second link/example, replace:

# ad code here

with

echo '
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!– Responsive –>
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-xxxxxxxxxxxxxxxx"
data-ad-slot="xxxxxxxxx"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
';

and you should be good to go...  remember, use the raw code button to copy so your dont get dorked up quote characters...  and of course, replace your adsense publisher info back in there... ;)

kvr28
Member
Free Members
Oct 20, 2014 - 8:22 am

thanks! Will give it a shot

Yellow Swordfish
Glinton, England
Member
Oct 20, 2014 - 8:51 am

Will await developments!

kvr28
Member
Free Members
Oct 23, 2014 - 5:24 pm

finally got it to work, thanks for your help gents, I still think a plug-in is still ideal though, KISS imo, if someone wants to add outside of the plug in, they can make the mods needed, a large majority of simple press users don't feel comfortable modifying files

Mr Papa
Simi Valley, CA
Member
Free Members
Oct 23, 2014 - 8:20 pm

glad you got it working...  we are constantly considering user ideas and yours (have had couple other requests for same) has been noted...

kvr28
Member
Free Members
Oct 24, 2014 - 9:17 am

nice, this may sound like a weird question, is there any way to disable the ads if members are logged in?

Yellow Swordfish
Glinton, England
Member
Oct 24, 2014 - 9:22 am

You can wrap your ad code like this...

if ( ! is_user_logged_in() ) {
    ... your ad code here...
}

This is a core WordPress function that returns true or false so this will only run the ad code if the user is NOT logged in.

kvr28
Member
Free Members
Oct 24, 2014 - 9:40 am

thanks yellow, I would still need the echo at the top and the comma semi-colon at the end though correct? 

kvr28
Member
Free Members
Oct 24, 2014 - 9:42 am

would it look like this?

echo 'if ( ! is_user_logged_in() ) {<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Responsive -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="xxxxxxxxxxxxx"
data-ad-slot="xxxxxxxx"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>';}

Mr Papa
Simi Valley, CA
Member
Free Members
Oct 24, 2014 - 9:48 am

No....

if (!is_user_logged_in()) {
    echo '
    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <!– Responsive –>
    <ins class="adsbygoogle"
    style="display:block"
    data-ad-client="ca-pub-xxxxxxxxxxxxxxxx"
    data-ad-slot="xxxxxxxxx"
    data-ad-format="auto"></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    ';
}
< 1 2 3 >