Disable ads on Error page and Terms&condition/Privacy Policy in Newspaper theme

Posted in: Newspaper
Post count: 21

Hi,

I couldn’t find the option to disable the ads on Error page and Terms&condition/Privacy Policy in Newspaper theme

According to Google, one cannot show ads on error page

Can anyone tell me how to disable the ads on error pages

Post count: 7909

Hi,

You can block ads on error page using is_404 function like this – http://screencast.com/t/B9Jf4MXhA3k
https://codex.wordpress.org/Function_Reference/is_404

if (!is_404()) {}

Thanks!

Post count: 54

Hello,

I tried this code and ads show it.


if (!is_page_template( 'nativead.php' )) {
$buffy .= '<div class="td-a-rec td-a-red-id-' . $spot_id . $align . ' '
. ((!empty($ad_array['disable_m'])) ? ' td-rec-hide-on-m' : '')
. ((!empty($ad_array['disable_tl'])) ? ' td-rec-hide-on-tl' : '')
. ((!empty($ad_array['disable_tp'])) ? ' td-rec-hide-on-tp' : '')
. ((!empty($ad_array['disable_p'])) ? ' td-rec-hide-on-p' : '')
. '">';
$buffy .= do_shortcode(stripslashes($ad_array['ad_code']));
$buffy .= '</div>';
}

Post count: 7909

Hi,

You can try to use the above code for 404 page and use is_page fuction for other pages – https://codex.wordpress.org/Function_Reference/is_page and add the page id.

Thanks!

Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.