Exclude inline article ads on specific categories / posts?

Posted in: Newspaper
Post count: 79

Hi,

I was wondering if it would be easy to have an option to exclude inline article ads from specific categories, or even at a post-by-post basis.

Thanks a lot

Post count: 23312

Hello meremetia,

If you want to exclude the inline article ads from specific categories or posts, you have to use a bit of CSS code to hide it. First of all, you have to get the category ID or post ID for your desired category or post, using your inspector and then you have to use the code below -> http://screencast.com/t/iqos0u0vY -> http://screencast.com/t/tpr1vFp2

Hope this helps!

Thank you for the message!

Post count: 79

hello,

I am checking with inspector but the post categories are not included in the <body class=

could you please advise?

thanks!

Post count: 23312

Hello meremetia,

Please notice that you have to use only the category ID or post ID which you can get with your inspector. Please provide your website so I will can provide you an example.

Thanks.

Post count: 80

Obrigado por isso, foi de grande ajuda.

Post count: 80

Hello,

I insert this code, but AD-2 don’t go out.

/* Removi anuncios post patrocinado Lebes */
.postid-77145 .td-a-rec-id-content_inline {display:none;}
.postid-77145 .td-a-rec-id-content_top {display:none;}
.postid-77145 .td-a-rec-id-content_bottom {display:none;}
.postid-77145 .td-a-rec-id-content_custom_ad_2 {display:none;}
/* Fim */

.postid-77036 .td-a-rec-id-content_custom_ad_2 {display:none;}

Print https://flic.kr/p/HqNTQq

My website http://www.eusouandroid.com
I add this post to you see this don’t work http://eusouandroid.com/download-uc-browser-navegador/

Post count: 23312

Hello pedroarmindo1,

I have checked your website and it seems to work your custom ad 2, as you can see here -> http://screencast.com/t/qHINcnIm Please provide a screenshot with your custom ad 2 field so I can see what type of code you are adding there.

Thanks.

Post count: 80

Hello,

That is the problem. It works fine. But I want to hide in the post: http://eusouandroid.com/download-uc-browser-navegador/

I inserted the code in the Custom CSS did not work: .postid-77036 .td-the-rec-id-content_custom_ad_2 {display: none;}

Print http://prntscr.com/b8nucv

Post count: 23312

Hello,

Please try the code below and place it in Theme panel->CUsotm CSS area.

The code is ->

.postid-77036 .td-a-rec-id-custom_ad_2 {
display:none!important;
}

The result -> http://screencast.com/t/BjqySvxicwW

Thanks.

Post count: 80

Thanks very much. It’s worked.

Post count: 15

Hello,

All the code that I’ve tried before include specifing the postid in css, but that’s not practical because I need to edit the css every time I add new post to category. Could you please provide some details and/or code that I can use to exclude the article-inline, article-top and article-bottom ads from all the posts that are within the specific category. I’m asking this because it’s not very clear to me how to do that from discussion above.

Thank in advance

  • This reply was modified 10 years by mabaz.
Post count: 23312

Hello mabaz,

Unfortunately, our theme does not have such an option that offers you a way to exclude these ads for all the posts from a specific category, sorry! If you want to achieve this, you will need to do some additional customizations through code, add some if/else statements. Also, you will have to use the is_category() For more references in this regard, please consult the Codex documentation here -> https://developer.wordpress.org/reference/functions/is_category/ All of these customizations might to be added in td_module_single_base.php, the place where these ads are generated, like this -> http://screencast.com/t/EzUK0Dx8
If you want to develop our theme and if you are not aware of the steps which are needed to take in this regard, please consider hiring a freelancer/developer to help you because we cannot provide customization services at the moment, sorry!

Thanks for your understanding!

Post count: 15

Hello Catalin,

thanks for your effort. I’ve tried to sort it out using css in custom code and it seems to be working as I wanted.
CSS code that I’ve uesd is:
article:not(.category1):not(.category2) .td-a-rec-id-content_inlineleft {display:none;}
where .category1 and .category2 are selectors of articles with specific class attributes.

  • This reply was modified 10 years by mabaz.
Post count: 23312

Hello mabaz,

I feel glad that I could help you.

Thanks.

Post count: 80

Hello,

The only problem with this is that even with the Custom CSS, the ads still carry with the page, and at certain times it is possible to see the page of relocating to hide the ads.

There is a way to block the loading?

Post count: 80

Thanks, work for me:

/* Remover anuncios de uma categoria específica Sorteio */
article:not(.sorteio) .td-a-rec-id-content_inline {display:none!important;}
article:not(.sorteio) .td-a-rec-id-content_inlineleft {display:none!important;}
article:not(.sorteio) .td-a-rec-id-content_top {display:none!important;}
article:not(.sorteio) .td-a-rec-id-content_bottom {display:none!important;}
article:not(.sorteio) .td-a-rec-id-custom_ad_1 {display:none!important;}
article:not(.sorteio) .td-a-rec-id-custom_ad_2 {display:none!important;}
article:not(.sorteio) .td-a-rec-id-custom_ad_3 {display:none!important;}
article:not(.sorteio) .td-a-rec-id-custom_ad_4 {display:none!important;}
article:not(.sorteio) .td-a-rec-id-custom_ad_5 {display:none!important;}
/* Fim */

Post count: 15

Hello,

I’m not aware of any straightforward solution to what you’ve asked but there are some recommendations that you can consider. On my website I have added following code to .htaccess file:
ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
ExpiresByType text/css "access plus 604800 seconds"
ExpiresByType text/javascript "access plus 604800 seconds"
ExpiresByType application/javascript "access plus 604800 seconds"
ExpiresByType text/html "access plus 2592000 seconds"

So it’s kind of workarround but it optimize loading because those lines utilize browser caching so user’s browsers will not fetch images (I’m guessing your ads are some kind of images) that often (as it would if there’s no mentioned code in .htaccess).
As you can see I’ve done same ‘optimization’, in terms of loading those resources, for the css and js.

Post count: 80

Thanks.

Please, look my CustomCod, see it’s ok.

/* Remover anuncios de uma categoria específica Sorteio e Parceiros */
article:not(.sorteio):not(.parceiros) .td-a-rec-id-content_inline {display:none!important;} .sorteio.parceiros
article:not(.sorteio):not(.parceiros) .td-a-rec-id-content_inlineleft {display:none!important;} .sorteio.parceiros
article:not(.sorteio):not(.parceiros) .td-a-rec-id-content_top {display:none!important;} .sorteio.parceiros
article:not(.sorteio):not(.parceiros) .td-a-rec-id-content_bottom {display:none!important;} .sorteio.parceiros
article:not(.sorteio):not(.parceiros) .td-a-rec-id-custom_ad_1 {display:none!important;} .sorteio.parceiros
article:not(.sorteio):not(.parceiros) .td-a-rec-id-custom_ad_2 {display:none!important;} .sorteio.parceiros
article:not(.sorteio):not(.parceiros) .td-a-rec-id-custom_ad_3 {display:none!important;} .sorteio.parceiros
article:not(.sorteio):not(.parceiros) .td-a-rec-id-custom_ad_4 {display:none!important;} .sorteio.parceiros
article:not(.sorteio):not(.parceiros) .td-a-rec-id-custom_ad_5 {display:none!important;} .sorteio.parceiros
/* Fim */

http://prntscr.com/c14wnd

Post count: 79

Hello,
It used to work fine using a code like :

article.category-XXXX div.td-g-rec-id-content_inline {display: none}

but after the last theme it doesn’t seem to be working anymore.

What’s more, I don’t see any classes like this in the body tag when I view source.

I am wondering if the structure has changed at a last update and how to make it so inline ads will not appear if article is in category “XXX”. Could you help?

Thanks again!

Post count: 23312

Hello meremetia,

I have tested on my side and the code works as properly. Please be more careful about what type of add you are using. So, if you will use the Google Adsense code you will have to use the .td-g-rec-id-content_inline class and if you are using other ads, you will have to use the .td-a-rec-id-content_inline class.

Hope this helps!

Thanks.

Post count: 79

Hi Catalin,

I think my problem is that apparently there is no article.category-XXXX added to the <body> any more.

Please see the screenshot here to understand what I mean: http://imgur.com/rnoBFqP

Any ideas how to fix?

Post count: 23312

Hello meremetia,

I suppose that you want to hide the article inline add for single posts, right? If you want this, please notice that you simply add the post ID number in front of the CSS code that hides the ad. For example, you can try this method -> http://screencast.com/t/0hdDLOp0

If you refer to something else, provide a screen pointing to the desired result, it would help us to understand what you’re trying to do.

Thanks.

Post count: 79

hi,
I want to automatically hide the inline adds for posts that are of certain category, let’s say “trains”.

In the past, I was able to do it with

article.category-trains div.td-g-rec-id-content_inline {display: none}
article.category-trains div.td-a-rec-id-content_inline {display: none}

and that’s because there was a class article.category-trains added to the body of all articles that are in the trains category.

however, as you can see from my previous screen (and also your screen) the class article.category-CATNAME is no longer added to the body tag of articles

hope the above clarifies

  • This reply was modified 9 years by meremetia.
  • This reply was modified 9 years by meremetia.
Post count: 23312

Hello meremetia,

Please look at this screenshot -> http://screencast.com/t/WUIb8W5uc and from here you can use the category.

Thanks.

Post count: 200

Hi tagDiv team,

I also would like to stop from loading the article inline ad in all our video articles (see this)

I currently have the following code in our custom CSS theme section.

Right after it, I’m adding the following code from above:

article.category-179 div.td-g-rec-id-content_inline {display: none}

where the number 179 is our video category ID.

Unfortunately the ad still loads.

Any other ideas how to fix this?

Thanks

  • This reply was modified 9 years by DaveS.
Viewing 25 posts - 1 through 25 (of 39 total)
You must be logged in to reply to this topic.