Remove theme panel ads from specific category

Posted in: Newspaper
Post count: 33

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.
Post count: 6535

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!

Post count: 115

Hi Andrei
Not work
I did exactly like you

Show sintax php error

Post count: 22421

Hello,
There seems to be a typo in the code Andrei provided. Please replace in_coategory with in_category
Thank you!

Post count: 33

Hello,

Or you can use css to avoid replace this code every update.

.category-25 .td-g-rec-id-content_inlineright
.td-g-rec-id-content_bottom
{
display: none!important;
visibility:hidden!important; }

25 = ID number of category

Enjoy!

Post count: 115

I understand

I search like this look

<?php if (in_category(‘IDCAT’)) { ?>
Show add here

<?php }else { ?>
Ads Code Here
<br />
<?php } ?>

Post count: 95

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

Post count: 22421

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.

Post count: 95

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; }

Post count: 22421

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!

Post count: 80

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.

Post count: 20688

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

Viewing 12 posts - 1 through 12 (of 12 total)
The forum ‘Newspaper’ is closed to new topics and replies.