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 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 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))
“$ 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.