Disable Ads on Particular posts!

Posted in: Newspaper
Post count: 341

Hi, I have 3 ads on each page.
I am using post template 11 on few pages, so if I show ad for page template 11, there will be 4 ads — it violates adsense policies.

Is it possible to remove a particular ad position for that post? or all posts using that template?

Like we could edit the template and remove the code for article bottom ad?
Or we could remove the code for article inline ad?

But only for template 11.

Thanks. 🙂

Post count: 1291

Hi,

You have to create a condition like this: – http://screencast.com/t/V9KL3CxHtRE – the condition can be added on the other ad lines(depending on which one you want to disable) – http://screencast.com/t/WH8vXMkQkhttp://pastebin.com/dKCv4qVU

$td_post_settings = get_post_meta($this->post->ID, 'td_post_theme_settings', true);
        $display_ad = 0;
        if(!empty($td_post_settings['td_post_template'])){
            if($td_post_settings['td_post_template'] == "single_template_11"){
                $display_ad = 1;
            }
        }
//add the top ad
        if (td_util::is_ad_spot_enabled('content_top') and is_single() and ($display_ad == 0)) {
            $content = td_global_blocks::get_instance('td_block_ad_box')->render(array('spot_id' => 'content_top')) . $content;
        }

Thank you!

  • This reply was modified 11 years by Emil G.
Post count: 48

Thanks!

Post count: 341

Thank you so much. <3
Had it been some other theme, I could not even hope of getting an answer.

Great features + Super great support = I am here. 🙂

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