Hello Team,
I used the theme panel ads manager and also using the custom ad inside specific category so its show all ads in this category i need to remove article top, buttom and inline ad from this category only and keep customs ads.
Regards
-
This topic was modified 10 years by
Mido.
Hi
To remove article inline ads from articles which are in a specific category you need to add a condition like here: http://screencast.com/t/JS2Gloru
and !in_coategory('category name/slug/id')
Just add your category name or tag or id inside the indicated function. Note that if a post belongs to more categories you need to add all those category inside the function. In thet case the code will look like this:
and !in_coategory(array('cat1', 'cat2'))
Let me know how it goes!
Thanks!
Is there any “tag” version?
If I have a tag e.g. noads in that post
then it will not display any ads in that post
Thanks
Hello,
The WordPress codex offers this information (that’s where we get it also). There is a function called has_tag:
https://codex.wordpress.org/Function_Reference/has_tag
if has_tag(‘noads’)
Thanks.
So I can use this CSS code to hidden ads?
.tag-25 .td-g-rec-id-content_inlineright
.td-g-rec-id-content_bottom
{
display: none!important;
visibility:hidden!important; }
Hello,
The function I provided is to remove the code from the php files. If you simply want to hide it, then you can use the css. But this will only remove the ad from the tag page. It will not remove the ad from posts that have this tag set to them. That is done with php and the function I showed above.
Thank you!
I would like to remove from all posts with certain category. Could provide the code example. From the link that has passed, I can not build a structure, much less implement it.
Hi,
You will have to edit the mentioned file, and insert your condition there like previously mentioned in this topic
– https://www.screencast.com/t/SuDczRp03x
Example for the category “Travel”
– https://www.screencast.com/t/zCF1Nsmmnz
Thanks
