WordPress Widget: Spread Firefox

I coded a widget to help Spread Firefox via a WordPress widget. Here is the code:

function wp_widget_firefox($args) {
	extract($args);
?>
	<?php if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) {?>
		<?php echo $before_widget; ?>
		<?php echo $before_title; ?>
		<?php _e('Try Firefox'); ?>
		<?php echo $after_title; ?>
		<ul><li>
			<a href="http://www.spreadfirefox.com/?q=affiliates&id=YOUR_ID&t=210"><img border="0" alt="Firefox 2" title="Firefox 2" src="http://sfx-images.mozilla.org/affiliates/Buttons/firefox2/firefox-spread-btn-1b.png"/></a>
		</li></ul>

	<?php echo $after_widget; ?>
	<?php
	}
	?>
<?php

}

I honestly don’t know if this exact code will work for people because I came up with my own system of creating widgets. However, you should be able to use this as a template if you know how to add widgets to your WordPress blog. Note that the code assumes that it will be in a file that contains other widgets. That’s why the php tags are the way they are.

I wrote the code so that it only shows the widget when the user agent/browser is IE. There’s no point in showing it for people who are already using Firefox, or any other browser for that matter. I don’t like to see things that don’t apply to me.

For example, that DirecTV commercial with Pamela Anderson. She looks at the camera and berates the viewer for not watching her on DirecTV. As a matter of fact, I am using DirecTV. Advertising needs to be smarter than that.

BTW, although the link has affiliate info, Spread Firefox Affiliates don’t make money as with other affiliate programs. For me, I just like to know how I am contributing to the effort.

2 thoughts on “WordPress Widget: Spread Firefox”

Leave a Reply

Your email address will not be published. Required fields are marked *

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