Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
requests-topic
Any thoughts for a advertisement plugin?
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
Offline
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... ;)

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

thanks! Will give it a shot

Avatar
Yellow Swordfish
Glinton, England
SP Master
Offline
Oct 20, 2014 - 8:51 am

Will await developments!

andy-signature.png
YELLOW
SWORDFISH
Avatar
kvr28
Member
Free Members
Offline
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

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
Offline
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...

Avatar
kvr28
Member
Free Members
Offline
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?

Avatar
Yellow Swordfish
Glinton, England
SP Master
Offline
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.

andy-signature.png
YELLOW
SWORDFISH
Avatar
kvr28
Member
Free Members
Offline
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? 

Avatar
kvr28
Member
Free Members
Offline
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>';}

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
Offline
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>
    ';
}
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17362
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625