How we exclude an advertisement or element of a particular “Post” in WordPress

WordPress It is a very simple system with which we can create a website in a few minutes. We only need a little knowledge of PHP, SQL and a server to host the files.
When it comes to We add ads in the pages with items Of a website created with WordPress, the pregnancy is quite easy. To 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. The ad or ads can be placed anywhere we want. Before the content, according to the content, by title, etc.
Once added the code HTML or Java of an announcement, itwill be automatic vision in all pages with items from the website / blog. The problem arises when We want to exclude ads from certain pages of the websiteto.
If we do not want the ads not to appear in a certain article, we have to take a few simple steps, but that require little attention.

How can we exclude ads / advertisements from certain pages of a blog or website made with WordPress

First of all we need a acces FTP or of any other access path to us allow access and Editing the WordPress theme files in which we have or are going to have the ads.
Suppose the ads will be in single.php, common file of all articles in 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 to be displayed “COD ADS”. I identify it very easily in the browser 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 specified by you.

Passionate about technology, I write with pleasure on stealthsetts.com starting with 2006. I have a rich experience in operating systems: Macos, Windows and Linux, but also in programming languages ​​and blogging platforms (WordPress) and for online stores (WooCommerce, Magento, Presashop).

Home Your source of IT tutorials, useful tips and news. How we exclude an advertisement or element of a particular “Post” in WordPress
Leave a Comment