Log in

View Full Version : Hide AdSense from error page


chefy
07-27-2013, 04:19 PM
Hi guys,

I have AdSense on my navbar template. I'm looking for a conditional to prevent AdSense from being displayed on the error page that you get when someone attempts to access to a deleted post. When you're on a deleted post the page is blank (no content) but only the following line of code:

$vbphrase[invalidid]

Invalid {1} specified. If you followed a valid link, please notify the <a href="{2}">administrator</a>

How I can prevent AdSense from showing on those pages?

Thank you!

Lynne
07-28-2013, 11:13 PM
Is the url always postings.php? If so, you can use THIS_SCRIPT in the condition and not show it if THIS_SCRIPT == 'postings' Or, if it's always the showpost.php page, do the same but for THIS_SCRIPT == 'showpost'

chefy
07-29-2013, 01:52 PM
Thanks, it was on showpost.php pages so this one worked like a charm to prevent displaying ads on those pages: THIS_SCRIPT != 'showpost'

However it prevents ads from being displayed on all showpost.php pages even those that actually have content. Is there any easy way to prevent ads from being displayed only when the content has been remove i.e. when the system display the following error message:

$vbphrase[invalidid]

Invalid {1} specified. If you followed a valid link, please notify the <a href="{2}">administrator</a>

Thanks.

Lynne
07-29-2013, 04:12 PM
Perhaps add into your condition something regarding whether the postid exists?:

AND (!$postinfo['postid'])

(I'm not sure what template this is in, so you may need to try !$post['postid'] or !$GLOBALS['postid'] instead)

matrog
03-12-2014, 07:19 PM
I'm interested in this script since adsense ban account if ads are shown on error pages, can anyone help me?

Simon Lloyd
03-13-2014, 06:28 PM
Maybe a condition if($post[postcount] == 0)