Hide Inpost Ads only on specific posts

Posted in: Newsmag
Post count: 76

Hey guys, so I have a problem. I set up for the automatic inpost ads to show up in the middle of the posts and at the very end. However I have one particular post where it’s working with a brand and they don’t want any ads or extra stuff showing in the post. How do I remove the inpost auto ads from showing up in a specific post(s)? And as a request (for both NewsMag and NewsPaper – make a sort of checkbox that allows us to turn on and off the auto ads on a per post basis).

Thanks!

Post count: 6600

Hi,

You can hide them on specific posts using custom css code or you can also use a plugin like Advanced Custom Fields and use this method to do it: https://forum.tagdiv.com/topic/function-to-hide-ads-and-function-to-show-author/
I will add this on our request list and we will consider it for future updates if we decide to change theme ads system.

Thanks

Post count: 76

Hey @Lucian I tried to follow that tutorial, unfortunately the step that says to place the code in the td_modules_blog.php that file is non-existent in the Modules folder. Please help, where then should I be placing the codes??

Post count: 6600

Hi,

Since then that code has been moved to the td_module_single_base.php here: http://screencast.com/t/yujqe7kVkQ

Thanks

Post count: 76

I’m really hoping I can get some help on this issue ASAP.

I followed the new guide to adding the code, but now I have other issues following the tutorial.

Now that I’ve found the right file and I’ve added the codes as outlined above, I’m running into other issues. I followed the steps to add the code based on the field names I made (I created three hide_inline_ads, hide_top_ad and hide_bottom_ad) so it would have been easier for me to identify which is which. I placed in the code like you can see in this image:
Codes when added to the td_module_single_base.php file

But for some reason now when I check the posts themselves on the frontend nothing shows up (I’m currently testing this on my staging site). Any ideas what’s wrong in the code?

Here’s how the front end looks when you visit a post:
Blank Posts

And this is the ACF fields added:
ACF added

Any ideas what’s going on?

Post count: 1291

Hi,

From your image I suspect that there’s an issue with the single quotes format – http://screencast.com/t/phGkV4AF
Copy the ones used on the default code, if possible use a code editor like Notepad++ to edit that file.

Thank you!

Post count: 76

Thank you Emil! It worked. I did edit it and used the pasted in code from the original post, but I guess for whatever reason it copied over weird in the editor. Fixed it and now it works! 🙂

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