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 quite easy. On most topics WordPress (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 from the website / blog. The problem arises 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 can we 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 theme files WordPress 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:

<?php
if (! is_single($Post))
{ ?>
COD ADS
<?php };?>

“$ Post” will be replaced with the ID number of the item in which you do not want “ADS CODE” to be displayed. You can easily identify it 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.

Passionate about technology, I enjoy writing on StealthSettings.com since 2006. I have a rich experience in operating systems: macOS, Windows, and Linux, as well as in programming languages and blogging platforms (WordPress) and for online stores (WooCommerce, Magento, PrestaShop).

How to » net Surfing » How do we exclude an ad or item from a particular "Post" in WordPress
Leave a Comment