@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.
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!
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!
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!
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
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
