Exclude inline article ads on specific categories / posts?

Posted in: Newspaper
Post count: 23312

Hello DaveS,

Check the results after you clear all of your caches. Also, if the problem is still there, you should provide your website URL so I can take a closer look at it and also, so I will be able to provide a more accurate code.

Thanks for the message!

Post count: 15

@mermetia and @DaveS did you try using !important; at the end of your css rules. It might help you because your former rule that worked is now overriden with the same rule from theme, so maybe all you need to do is add !important… like this:

article.category-179 div.td-g-rec-id-content_inline {display: none !important;} or
article.category-trains div.td-g-rec-id-content_inline {display: none !important;}
article.category-trains div.td-a-rec-id-content_inline {display: none !important;}

  • This reply was modified 9 years by mabaz.
Post count: 200

Cheers for that, it works!

Post count: 200

Hi guys,

I minified the theme’s style.css but didn’t minify the child theme’s style.css which contains almost nothing. Since then this last suggestion stopped working for some reason.

The following line of code is in my theme panel’s custom css field:
article.category-179 div.td-g-rec-id-content_inline {display: none !important;}

but the inline ad loads again.

Can a recent theme update be the reason for this to stop working? Any ideas?

Thanks!

Post count: 23312

Hello DaveS,

This code should not have any link with the new theme update. Probably, you have chosen the category ID and that’s why the code does not work. Try to use it to be a general rule and check the results.

.td-g-rec-id-content_inline {display: none !important;}

Notice that the td-g-rec class refers to Google AdSense code. If you are using other ads, you should use the td-a-rec.

Hope this helps!

Thanks for the message!

Post count: 200

I’ve put your code in the custom css field of the theme

.td-g-rec-id-content_inline {display: none !important;}

but the ad (it’s an adsense ad) still loads. My category ID is 179. I should include this somewhere??

Post count: 23312

Hello DaveS,

Please provide your website so I can inspect it closer and also, so I will be able to provide a more accurate response.

Thanks for the message!

Post count: 200

Let me know what exactly to include in my custom css theme field so you can make the inspection.

Post count: 200

It’s important to know that he adsense ad shouldn’t load at all, not that the script is called and then the ad hidden. This will be an adsense violation.

Post count: 23312

Hello DaveS,

The code which I gave you above you should add into your Custom CSS box and if you want that the code to be applied only for a specific category you should add the category ID in front of this code. If you will provide your website URL and the specific category where you want to hide this add so I can provide the final code if you fail to do this.

Thanks for your understanding!

Post count: 200

Hi Catalin,

here it is: bit. ly/2sfnyaq

Thanks

Post count: 20685

Hi,

This is the easy way, hiding the ad with css although maybe it is not recommended I believe. Please use this code and it will work properly for the inline ad, when it is aligned to the right like in this case
https://www.screencast.com/t/d31dDFEFE1

.category-179 .td-g-rec-id-content_inlineright {
display: none;
}

Thanks

Post count: 200

Hi,

the ad code should be loaded at all, otherwise it’s an Adsense policy violation.

Can I stop it from sending the request to Google and rendering at all?

Thanks

Post count: 20685

Hi,

To stop the ad from loading you will probably have to create conditions in the theme code, like Catalin suggested in previous replies in this topic. There are no options in the theme to not display certain ads for specific posts, from a given category. You can either enter the ad code and it will be displayed as it should, or don’t use the ad.
Some users use plugins that have options for this. You can search here on the forum for similar topics, like this one for example and see if it works for you
https://forum.tagdiv.com/topic/disable-adsense-ads-on-specific-posts/

Thanks

Viewing 14 posts - 26 through 39 (of 39 total)
You must be logged in to reply to this topic.