Some time ago I posted a question on here trying to figure out how to remove AdSense on individual posts. I have figured out how to do it with the help of some online forums. However, I need someone’s help here at tag div to tell me where to implement the code.
After placing this code in the Newspaper-child/parts/header/ads.php right above the /head tag I am able to add individual post id’s like such.
<?php Global $ad_flg; $ad_flg=1; ?>
<?php $adsense_blck_post = array(7130); ?>
<?php if (in_array($post->ID,$adsense_blck_post,true)) $ad_flg=0; ?>
>>> http://postimg.org/image/4v4accd8r/
Now, to alter indivudal ad spots. I surrounded:
<?php
global $adsense_flag;
if($adsense_flag!=0) {
echo td_global_blocks::get_instance('td_block_ad_box')->render(array('spot_id' => 'post_style_12'));
}
?>
>>> http://postimg.org/image/tx9j3xoqz/
I just need to know where to find the rest of the code implementation. I’ve found the header and footer ad, smart lists ads, and ads on individual posts. However, I’m looking for the Article_top_ad and article inline ad. Could someone point me in the right direction.
Thanks!
-
This topic was modified 10 years by
jcarr99.
Hi,
Unfortunately the ad boxes cannot accept php code so you cannot customize ads from there. Please follow this topic to see how it can be done: https://forum.tagdiv.com/topic/disable-ads-on-particular-posts/
Hope this helps.
Thank you!
Bogdan,
Thanks again! I found it but the implimentation doensn’t seem to be going well.. Could you let me know what I’m doing wrong?
Hello sir, How we can disable all adsense ad on individual post. I get notifaction from adesense to remove ads on single post.
Please guide.
Thanks
Hi,
Unfortunately our theme does not offer this feature so you can only remove the ads from posts by editing the theme files. For the content top bottom or inline ads, you can simply remove the adsense code from the theme panel and for the header or footer ad, you can add a condition to the file: https://developer.wordpress.org/reference/functions/is_single/
You can find the code for the header ad here: http://screencast.com/t/yVhthn6VqkA
for the footer: http://screencast.com/t/neBRlrel
Thank you!
Hello sir, I’m not wanting to remove top bottom or inline ads on all pages. But only on some individual pages by tags or category or post id.
Hi,
In this case you will have to add conditions to this code:
http://screencast.com/t/H23JT3q4o – http://screencast.com/t/A60hJE4Ah7K1
Thank you!
I think you are not understanding my problem, I just want to remove ad only on some posts number. Bogdan B. I don’t understand what you said to change and where to add post id to remove all ads from these posts…
If it is possible then tell us otherwise we try to remove these affected posts.
If you’d like, I just figured out how to do this and I’d be happy to add it into your theme… Please contact me
…
Hi,
There is no setting for this as I have stated above. It will have to be done either through a plugin like IngGeek suggested or custom made (hard-coded).if you do not have the proper skills to code it in, I suggest getting some help for it. (jcarr99 already offered to help on this)
Unfortunately custom work is not part of the theme support so i cannot provide a solution here. I can only point you in the right direction.
Thank you!