How do we exclude an ad or item from a particular "Post" in WordPress

WordPress is a very simple system with which we can create a website in minutes. We only need a little knowledge of PHP, SQL and a server on which to host the files.
When it comes to it we add ads to the articles pages of a website created with WordPress, the task is pretty easy. For most WordPress themes (WP Themes), the article page is given by the file single.php or content.php, usually located in the root of the theme. Your ad or ads will be placed wherever we want. Before content, by content, by title, etc.
Once the code was added HTML or Java of an ad, it will automatically be visible in all articles pages on the website / blog. The problem occurs when we want to exclude ads from certain pages of the websiteacquis.
If we do not want advertisements to appear in a particular article, we have to take a few simple steps but need a little attention.

How to exclude ads / ads from certain pages of a blog or website made with WordPress

First of all we need one FTP access or any other access path to us allow access si editing WordPress theme files where we have or are going to have the ads.
Let's assume the ads will be in single.php, a shared file of all articles on the website.
We edit the single.php file and add the code:
if (! is_single($Post))
{ ?>
<?php };?>

"$ Post" will be replaced with the article ID number in which you do not want to display "COD ADS". You identify it very easily in the browser's address bar when editing the article. "? Post =19067"

Save the single.php file and the ads will not be present on the page with the article you specified. If you have to add more pages in which you want the ads not to be present, add the comma IDs to each other.

How do we exclude an ad or item from a particular "Post" in WordPress

About the author


Passionate about everything that means gadget and IT, I am pleased to write on from 2006 and I love to discover new things about computers and macOS, Linux operating systems, Windows, iOS and Android.

Leave a Comment