A Single Article
Read it, comment, and share it with your friendsHow to remove cruft from Text-Link-Ads
I don’t know if anyone will find this useful, but I figured I would share how to remove the crufty inline CSS and spacings from Text-Link-Ads on your website. It’s a simple matter of finding the right function in your script (in my case, the Wordpress plugin they provide) and editing the “echo”s. Look for the function “outputHtmlAds()” and you should see this:
if( count($this->ads) > 0 ){
echo "\n<ul style=\"padding: 0; list-style: none; margin: 0; width: 100%; border: 1px solid #000000; border-spacing: 0px; background-color: #F0F0F0; overflow: hidden;\">\n";
foreach($this->ads as $ads) {
echo "<li style=\"padding: 0; clear: none; margin: 0; display: inline; width: 100%; float: left;\"><span style=\"width: 100%; font-size: 12px; color: #000000; padding: 3px; display: block; margin: 0;\">".$ads->before_text." <a style=\"color: #000000; font-size: 12px;\" href=\"".$ads->url."\">".$ads->text."</a> ".$ads->after_text."</span></li>\n";
}
echo "</ul>";
}
Crufty stuff huh? There are three reasons you might want to clean this up:
- Text ads are probably more effective if integrated with your site design.
- This cruft adds spacings that look funny if you are trying to align your text.
- If you change your site design, you would have to generate the plugin all over again… unless you take out the inline styling.
Convinced? Here’s the same portion of that code I showed you, without cruft and with an ID of “tla” that you can use in your stylesheet:
if( count($this->ads) > 0 ){
echo "\n<ul id=\"tla\">\n";
foreach($this->ads as $ads) {
echo "<li>".$ads->before_text."<a href=\"".$ads->url."\">".$ads->text."</a>".$ads->after_text."</li>\n";
}
echo "</ul>";
}
Now, you must listen very closely… do not edit this function so that you can apply your own CSS to hide these links or make them any less visible than they would be with the inline styling applied. That’s violating your terms of service and cheating on both Text-Link-Ads and your sponsors. I assume that anyone in the program is responsible enough to know this already, but it’s worth mentioning.
Copy/paste/enjoy. Let me know if you found this useful.
Get a Trackback link
1 Trackbacks/Pingbacks
Other blogs referencing this articleLeave a comment
Share your thoughts with the worldYou can use Markdown, or you can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>Please keep comments respectful and on topic.
This form is guarded by Akismet, so don't waste your time trying to submit spam. It won't work. Ever.