TutZone- Tutorials, Design news and Inspiration | ![]() |
How to Hide Advertisements for Single Posts Posted: 08 Jul 2010 04:48 AM PDT As in our previous tutorial, I showed you how to show your adsense to only Google visitors. In this tutorial you will learn how to hide advertisement for any particular post. This technique comes in handy if you publish many posts a day and want your regular readers not to get distracted by your ads, you can always show them up after a day is over or after a certain period of time. Step by Step Tutorial:Note: Do take backup of your theme before you try this. 01. You need to know the ID of the Post on which you don’t want to display your ad. For determining it, you can check below link 02. Go to Appearance => Editor. 03. Then choose single.php file from right hand side and go where you have added your ad code and change it to: ………… Your Advertisement Code ………… To: if(get_the_ID() != xx) { ………… Your Advertisement Code ………… } Replace xx with the post id for the post which you do not want to show advertisements for. 03. You can also use this on multiple posts, just keep adding your Post ID’s in below pattern: if(get_the_ID() != xx || get_the_ID() != xx) { ………… Your Advertisement Code ………… } 04. Save and you are done. Scripts Sources:That concludes this simple and useful tutorial. Hope you like it. |
You are subscribed to email updates from TutZone To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 20 West Kinzie, Chicago IL USA 60610 |
No comments:
Post a Comment