Header Ads Delete 404 Page and Search page and all page

Posted in: Newspaper
Post count: 38

Hi, i want to delete header ads from 404 page and search page and all page if no content, contact page ex. about us page, how can i do that, i want to only show header ads homepage and article page , thank you, http://prntscr.com/iela61 , Google says, you do not place ads with non-content pages, so why i want delete it, pls help me.

Post count: 38

if i delete header ads code, it will work ? where is the ads code ex. , can u help me pls ?

Post count: 23312

Hi,

If you want to remove the ad from the 404 page, you will have to edit the theme code as there is no option in this regard.
You will have to wrap the header and code in a condition to check if it’s a 404 page and not display the ad there.

<?php
if (!is_404() ) {
locate_template('parts/header/ads.php', true);
}
?>

The example is here -> https://www.screencast.com/t/2yhREtnUDHjd

You will have to do this for the header style that you use.

Thank you!

Post count: 38

Thank you and all page, how can i delete it ? 404, contact us, search page ex.

Post count: 23312

Hello valiente123,

If you want to apply that check for the other pages you should the following function from WordPress like this -> https://codex.wordpress.org/Function_Reference/is_search and here
-> https://developer.wordpress.org/reference/functions/is_page/

Hope this helps!

Thanks for the message!

Post count: 38

worked for 404 pages. But I can not make search pages and other pages, the codes I added do not work, please help me, how can I make contact and advertisement pages http://prntscr.com/inlp80

Post count: 23312

Hello valiente123,

Try to use the page ID and place it in your code if you want to be more accurate regarding on what pages you want to make these changes. It’s just a clue.

Thanks for the message!

Post count: 38

I did it this way but the site is not opening please help page id 357 please help http://prntscr.com/innuw9

Post count: 38

and how can i do for single page like contact and advertise page, i found id but where i write them, thank you Catalin for help us

Post count: 38

I did it this way, but not on the search page, but on the whole page the ad went- if (! is_404 &&! is_search ()) {

Post count: 23312

Hello valiente123,

Try the follow example from here -> https://www.screencast.com/t/WVGtdB4qxm

Thanks for the message!

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