Knowledgebase: Coding / Scripting
How To Hide Advertisements For Single Posts
Posted by Modestas J on 17 June 2012 03:07 PM

If for some reasons we don't want to show advertisement for single post, we can hide it by making simple customization to our theme. Just navigate to WordPress theme files directory and find file named "single.php". Then open it for editing and locate the place where advertisement code is placed. Place the following line of code above advertisement code:

if(get_the_ID() != PostID) {

Advertisement code

}

Don't forget to replace "PostID" with post ID for which we don't want to show advertisement.

If there is any doubt what post ID to use, go to "Posts" and click on any post. Then look at the address bar in the web browser. URL will be in the form like this http://example.com/wordpress/wp-admin/post.php?post=53&action=edit

This means post ID is 53. Now we can hide advertisements for any post we want.

The Best Web Hosting

(0 vote(s))
This article was helpful
This article was not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below. This is required to prevent automated registrations and form submissions.

Help Desk Software by Kayako Fusion