How To Remove Header Ads on 404 Page (Desktop and Mobile)

Posted in: Newsmag
Post count: 13

Hello. I want to remove the header ads showing on a 404 page. I can’t find any settings on the panel and wondering if I can do it backend. Also, I would like to change the articles showing on the 404 page. Instead of the latest articles, I want to show the articles from a certain category.

Post count: 23312

Hi,

Unfortunately, the theme does not have any such an option that allows you to do this from theme panel but you can do this if you will add such a condition in PHP. As a hint, please edit the ads.php core file and add the following checker from here -> https://www.screencast.com/t/DKrZPkGtWRLT Using this, you will check if your page is_404 and if it is, the ad will be removed, otherwise the ads will be displayed.

Thank you!

Post count: 13

Thank you. The codes that you provided above worked on the desktop. How about the mobile version? I can still see the ads appearing in 404 page while in mobile.

Post count: 23312

Hi,

Please note that this function target all the 404 pages, regardless of the port view (desktop or mobile device). Please provide your website URL so I can take a closer look at it and also, so I can make some tests.

Thank you!

Post count: 13

Hello,

Apologies for the late reply. Unfortunately, there’s still an ad code showing on a mobile device. I can’t post the URL here so if it’s possible, can you please send me a private message?

The ad code showing in the 404 page came from the ads that I added on theme panel > mobile > header ad.

Thank you.

  • This reply was modified 7 years by limez.
Post count: 13

So upon doing the edits myself, I found out that in order to hide the header ads on mobile, you need to go to wp-content > plugins > td-composer > mobile > header.php and from there do the following code edits -> https://i.imgur.com/IIpSCnb.jpg

Save the changes and it will hide the mobile header ads on 404 pages.

Post count: 23312

Hi,

Yes, you are right! When you are using the mobile theme, you will need to edit that header file which is assigned to your mobile theme functionality!

Thank you!

Viewing 7 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic.