Home » Smart Ads WordPress Plugin

Smart Ads WordPress Plugin

Author: John Kolbert
Version: 1.2
Last Update: May 11, 2008
Compatibility: 2.3+, 2.5+, others not tested
Description: Automatically add advertisements to the beginning and end of posts based on the post length, age of post, category, or blog member status.
WP-Extend: Official Listing at WordPress.org

Download Smart Ads Version 1.2

Downloaded 595 times from this page

Features at a Glance
  • Show ads above and below post content automatically
  • Only show ads on single.php or page.php, not homepage
  • Limit ad visibility by post word count
  • Limit ad visibility by post age
  • Limit ad visibility by category
  • Selectively disable ads on a post-by-post basis
  • Disable top ad if post begins with an image NEW!
  • Disable all ads for registered blog members
  • Add custom ads to posts or pages by selecting to type <!-smartads-> or {smartads} (for those who use visual editors) NEW!
  • Limit custom ads to be shown on only single post view or enable them on the homepage
  • Built for WordPress 2.5!
Extended Description

Smart Ads automatically, yet intelligently inserts advertisements like Google’s Adsense above and below your post content. These advertisements are only visible when viewing a single post (single.php). Since it doesn’t make sense to fill small posts with ads, users can set a “Wordcount” minimum for their advertisements. Smart Ads will only insert advertisements into posts that meet or exceed the desired Wordcount. Do you start your posts with an image? You can chose to disable the top ad if your post has an image tag (<img...) in the first number of characters (you set the limit)! Also, to ensure that new content remains fresh, users can chose to only place ads on posts that are over a certain amount of days old. Advertisements can be manually disabled on a post-by-post basis while writing a post, for entire categories, or for registered blog members.

Users can also insert custom ads into their posts by chosing to inserting <!-smartads-> or {smartads} into their post text. You chose which method you’ll use in the “Options” area of the plugin. This allows bloggers who use their visual editors complete functinoality (some were having trouble with the HTML comment). Custom ads are not affected by the Wordcount or date minimum requirements and can toggled to be shown on the index page or only shown when in single post view.

Installation
1. Download smartads.zip and unzip it.
2. Before uploading the folder, change yourads.php.txt to yourads.php. This prevents automatic upgrades from overwriting your file in the future.
3. Next, open "yourads.php" and paste your desired advertising code into the three indicated areas. yourads.php contains three variables which house your code data: $topad, $bottomad, and $customad. Sample data is provided as an example of how to paste your code. Replace the sample data by simply highlighting it and pasting your advertising code over it. Enter your ad code into the the other two variables to match.
4. Because we’re working with PHP data, you may have to “escape” your advertising code if it contains any single quotes ( ‘ ). Escaping means simply placing a forward slash before the single quote. So if the original sentence was: “Hello, I’m “hungry” didn’t you know?” You would escape it to look like the following: “Hello, I\’m “hungry” didn\’t you know?”. If your code doesn’t contain single quotes then this isn’t necessary.
5. Upload the plugin folder containing both files to wp-content/plugins/ and activate from the Plugin administrative menu.
Upgrading

Smart Ads is now fully compatible with the WordPress 2.5 automatic upgrade feature. Your advertising code will not be overwritten. If you chose not to use the automatic upgrade feature, disable the Smart Ads plugin, upload your newly downloadedsmartads.php file to your current smartads folder, and reactivate the plugin.

Options Explained In-Depth


Smart Ads Option Page

General Options Menu

Show Custom ads on Homepage The custom ads are called by placing <!-smartads-> in your post where you want the ad to appear. This setting allows you to show these custom ads on the homepage or only on the single post view.
Custom ads notation You can chose to use one of two notations to display custom ads in your posts and pages. <!-smartads-> is recommended because if you deactivate the plugin the snippet hides itself becaue its an HTML comment (and thus not visualized by your browser). However, bloggers who use the visual editor may have some problems with WordPress removing this code. Thus you can use {smartads}, which will do the same thing but won’t degrade as nicely if you deactivate the plugin.
Minimum Post Word Count Top and Bottom and will only appear on posts that meet or exceed the number of words listed here. This is to avoid short posts being overwhelmed with advertisements. A setting of 0 disables this feature.
Only show ads on posts older then the amount of days you chose. This keeps fresh content ad free while monetizing older articles. A setting of 0 disables this feature.
Top, Bottom, and Custom Ad The code that you pasted into “yourads.php” is dispalyed here for informative purposes only.
Category Exclusions List the ID of categories that that you don’t want ads to be displayed in. Category IDs must be listed with a comma and a space inbetween them, such as: 12, 3, 15, 1, etc. This does not affect custom ad visibility.
Disable Ads For Registered Members If selected, all ads will be disabled for readers who are logged into your blog. This includes the admin and all subscribers.
Hide per post options box Ads can be disabled on a per-post basis. However, some users have said they would like to hide this options box in the write-post screen entirely. This does just that without affecting any of your posts options (posts with ads disabled will still have them disabled).


FAQs

Why don’t some of my Adsense ads showup?

Google Adsense plolicy states that a maximum of three ad units may be placed on a single page. Make sure you don’t exceed this. If this isn’t your problem, make sure you have correctly pasted your adsense code into “yourads.php”.

How can I format the CSS around my ads (such as padding, margin, etc)?

Formatting the space above and below your ads is very simple. Open yourads.php and simply surround your advertising code with the html you want. You can add <div> tags and format them with CSS. The styling will apply to all ads of that type.

I want to place a large square ad at the beginning of every post, but the post content doesn’t wrap around the ad. How can I fix this?

This problem can be fixed with a little CSS tweaking. As in the question above, open yourads.php and surround your $topad code with the following CSS styling:

Code:

1
2
3
<div style="display: block; float: left; margin: 0px 10px 0px 0px;"> 
Your Ad Code Here
</div>

How do I insert my own ad code?

To insert your own ad code open yourads.php in a text editor, such as notepad, or code editor. In this file are three variable names “$topad”, “$bottomad”, and “$customad”. Each represents the top, bottom, and custom ads that will be inserted into your posts. Your code should be copied so it looks like the code below:

Code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//This advertisement will appear above your post content. You can surround it by any HTML you like (as shown).
$topad = '
<div style="display:block;float:left;margin: 0px 10px 0px 0px;">   
<script type="text/javascript"><!--
google_ad_client = "pub-xxxxxx";
/* 250x250, created 4/9/08 */
google_ad_slot = "xxxxxx";
google_ad_width = 250;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
'; //leave this line

How do I disable the advertisements just for the post I’m writing?

When writing or editing your post an options box will be visible below the post editing box with a checkbox that, if checked, will disable ads for that post only. This option only affects the automatic insertion of top and bottom ads. Custom ads will still appear if you include their tag.

Version History
  • Version 1.2: released on May 11, 2008
  • added ability to hide top ad if post begins with an image, added an aditional custom ad notation, revamped the “write post” options box and provided a way of hiding it
  • Version 1.1.2: released on April 16, 2008
  • fixed critical error with Smart Ads interfering with RSS content
  • Version 1.1.1: released on April 15, 2008
  • added ability to disable ads for all registered users
  • added ability to exclude ads for entire categories
  • Version 1.0.1: primary release on April 10, 2008
Copyright & Disclaimer

Copyright © 2008 by John Kolbert (aka Simply-Basic.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the “Software”), to deal in
the Software without restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Acknowledgements

Thank you to all those who have submitted feedback and helped improve the Smart Ads Plugin. A special thanks goes out to Michael for sending many of the feature requests that helped make Smart Ads..well, smart!

56 Comments »

Trackbacks

  1. The Best Blogging Software (WordPress) + The Top 60 WordPress Plugins | Midas Oracle .ORG
  2. SmartAds: Adsense ads WordPress Plugin » D' Technology Weblog: Technology, Blogging, Tips, Tricks, Computer, Hardware, Software, Tutorials, Internet, Web, Gadgets, Fashion, LifeStyle, Entertainment, News and more by Deepak Gupta.
  3. Smart Ads: Publicidad Inteligente | Frank Pereiro
  4. Wordpress Son Çıkan Eklentiler |
  5. Smart Ads WordPress Plugin
  6. Neues Design | The Blog that never sleeps

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Please read the comment policy before commenting.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.