<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ben Huson&#187; Plugin</title>
	<atom:link href="http://www.benhuson.co.uk/tag/plugin/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.benhuson.co.uk</link>
	<description>Web Designer and Developer</description>
	<lastBuildDate>Wed, 11 Aug 2010 21:23:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Integrating Google XML Sitemaps with Your WordPress Plugin</title>
		<link>http://www.benhuson.co.uk/2009/07/12/integrate-google-xml-sitemaps/</link>
		<comments>http://www.benhuson.co.uk/2009/07/12/integrate-google-xml-sitemaps/#comments</comments>
		<pubDate>Sun, 12 Jul 2009 19:22:50 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[SEO]]></category>
		<category><![CDATA[Web Developer]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[XML & RSS]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[WP e-Commerce]]></category>
		<category><![CDATA[XML Sitemaps]]></category>

		<guid isPermaLink="false">http://www.benhuson.co.uk/?p=822</guid>
		<description><![CDATA[Note: Please read my more recent post about Integrating Google XML Sitemaps with the latest version of WP e-Commerce using a plugin by Lee Willis. One plugin I recommend that everyone should add to their WordPress installation is the Google XML Sitemaps plugin. This plugin will automatically generate an XML sitemap of your posts and [...]]]></description>
			<content:encoded><![CDATA[<p><div class="note"><div class="noteclassic"><strong>Note:</strong> Please read my more recent post about <a href="http://www.benhuson.co.uk/2009/11/28/wp-e-commerce-xml-sitemap-wordpress-plugin/">Integrating Google XML Sitemaps</a> with the latest version of WP e-Commerce using a <a href="http://www.leewillis.co.uk/wordpress-plugins/">plugin by Lee Willis</a>.</div></div></p>
<p><strong>One plugin I recommend that everyone should add to their WordPress installation is the </strong><a href="http://wordpress.org/extend/plugins/google-sitemap-generator/"><strong>Google XML Sitemaps plugin</strong></a><strong>. </strong></p>
<p>This plugin will automatically generate an <a href="http://www.sitemaps.org/">XML sitemap</a> of your posts and pages and ping supporting search engines to notify them that the sitemap has been updated.</p>
<p>But the best thing about this plugin for other plugin developers is it provides hooks so you can &#8216;borrow&#8217; it&#8217;s functionality so that your plugin can add additional pages into the XML sitemap that is generated.</p>
<p>So if you&#8217;re a WordPress plugin developer, read on&#8230;</p>
<p><span id="more-822"></span></p>
<h3>How to add pages to the XML sitemap</h3>
<p>To illustrate how to implement the XML Sitemaps hook, I will base the example on the <a href="http://www.instinct.co.nz/3-7-1-feature-prioritization/trackback/">WP e-Commerce plugin</a> (please note, I originally implemeted this with version 3.6.12 of the WP e-Commerce plugin so it may not work with more recent versions). We will create a function that will add all of this plugin&#8217;s product pages into the XML sitemap produced by Google XML Sitemaps.</p>
<p>The Google XML Sitemaps plugin provides the hook &#8220;sm_buildmap&#8221; which gets triggered whenever the plugin re-builds the sitemap file. We are going to create a function &#8220;wp_ecommerce_sm&#8221; which will get called by this hook.</p>
<p>So, here&#8217;s the function code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> wp_ecommerce_sm<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">;</span>
   <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">class_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'GoogleSitemapGenerator'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$generatorObject</span> <span style="color: #339933;">=</span> <span style="color: #339933;">&amp;</span>GoogleSitemapGenerator<span style="color: #339933;">::</span><span style="color: #004000;">GetInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT DISTINCT * FROM `&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">prefix</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;product_list` WHERE `active` IN('1') ORDER BY `id` DESC&quot;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$product_list</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_results</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #339933;">,</span> ARRAY_A<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$product_list</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$product</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
         <span style="color: #000088;">$purchase_link</span> <span style="color: #339933;">=</span> wpsc_product_url<span style="color: #009900;">&#40;</span><span style="color: #000088;">$product</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         <span style="color: #000088;">$purchase_link</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&amp;amp;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&amp;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$purchase_link</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$generatorObject</span> <span style="color: #339933;">!=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$generatorObject</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">AddUrl</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$purchase_link</span><span style="color: #339933;">,</span> <span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;daily&quot;</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
   <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;sm_buildmap&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;wp_ecommerce_sm&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<h3>The main points to note in this function are&#8230;</h3>
<p>Check that the Google XML Sitemaps exists (is installed):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">class_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'GoogleSitemapGenerator'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></pre></td></tr></table></div>

<p>Get an instance of the Google XML Sitemap plugin:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$generatorObject</span> <span style="color: #339933;">=</span> <span style="color: #339933;">&amp;</span>GoogleSitemapGenerator<span style="color: #339933;">::</span><span style="color: #004000;">GetInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Loop through all our additional pages that we want to add to the sitemap, in this case the WP e-Commerce product pages:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>5
6
7
8
9
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT DISTINCT * FROM `&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">prefix</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;product_list` WHERE `active` IN('1') ORDER BY `id` DESC&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$product_list</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_results</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #339933;">,</span> ARRAY_A<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$product_list</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$product</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #666666; font-style: italic;">// Add pages to sitemap here</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>And within our loop, add our pages like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>10
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$generatorObject</span> <span style="color: #339933;">!=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$generatorObject</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">AddUrl</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$purchase_link</span><span style="color: #339933;">,</span> <span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;daily&quot;</span><span style="color: #339933;">,</span> <span style="color:#800080;">0.5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>And lastly we need to add the hook to call this function whenever the XML sitemap is rebuilt:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;sm_buildmap&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;wp_ecommerce_sm&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>Is that all there is to it?</h3>
<p>Well, not really. Your still have to trigger the sitemap to re-build to include your new pages. You can do this manually by going to your XML Sitemaps setting page and clicking the link to rebuild to force the sitemap to re-build. Ideally however you would try to get your plugin to do this automatically whenever you add/edit/delete one of your pages. I couldn&#8217;t find an obvious hook to easily do this so that is something I would like to see adding in a future version of the <a href="http://www.arnebrachhold.de/projects/wordpress-plugins/google-xml-sitemaps-generator/trackback/">Google XML Sitemaps</a> plugin.</p>
<h3>Download</h3>
<p>Download the above code packaged as a WordPress plugin using the link below:</p>
<a href="http://www.benhuson.co.uk/downloads/wp-e-commerce-smphp.zip" title="WP e-Commerce XML Sitemap Plugin (22)" >Click here to download...</a>
]]></content:encoded>
			<wfw:commentRss>http://www.benhuson.co.uk/2009/07/12/integrate-google-xml-sitemaps/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Stylish Categories for WP e-Commerce</title>
		<link>http://www.benhuson.co.uk/2009/04/22/stylish-categories-for-wp-e-commerce/</link>
		<comments>http://www.benhuson.co.uk/2009/04/22/stylish-categories-for-wp-e-commerce/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 22:51:45 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Developer]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Categories]]></category>
		<category><![CDATA[E-commerce]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Widgets]]></category>
		<category><![CDATA[WP e-Commerce]]></category>

		<guid isPermaLink="false">http://www.benhuson.co.uk/?p=724</guid>
		<description><![CDATA[I&#8217;ve made my first contribution to the WP e-Commerce plugin &#8211; my first contribution to an open source project&#8230; It&#8217;s a great e-commerce plugin for WordPress but there were a few visual things niggling me that I thought should be sorted out &#8211; mainly the way that the widget for showing categories was not styled [...]]]></description>
			<content:encoded><![CDATA[<p><strong>I&#8217;ve made my first contribution to the <a href="http://www.instinct.co.nz/e-commerce/">WP e-Commerce</a> plugin &#8211; my first contribution to an open source project&#8230;</strong></p>
<p>It&#8217;s a great e-commerce plugin for WordPress but there were a few visual things niggling me that I thought should be sorted out &#8211; mainly the way that the widget for showing categories was not styled the same way as the WordPress default widgets.</p>
<p>Fixing the issue was just a case of making a couple of tweaks to the HTML; changing some square brackets to normal brackets and removing some bold styling.</p>
<p>Nothing revolutionary there, but it should now look a whole lot better with your default WordPress theme without making any modifications&#8230;</p>
<p>The current version in development <a href="http://www.instinct.co.nz/wp-e-commerce-37-questions/trackback/">WP e-Commerce 3.7</a> is looking great, with an overhaul of the user interface to bring it into line with WordPress 2.7, a complete reorganisation of the code making it easier for us developers, and a new template engine which works along the same lines at the WordPress Loop so that theme authors can now get in on the act without having to delve too far into the plugin&#8217;s code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.benhuson.co.uk/2009/04/22/stylish-categories-for-wp-e-commerce/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Weather Traveller Plugin</title>
		<link>http://www.benhuson.co.uk/2008/08/18/wordpress-weather-traveller-plugin/</link>
		<comments>http://www.benhuson.co.uk/2008/08/18/wordpress-weather-traveller-plugin/#comments</comments>
		<pubDate>Mon, 18 Aug 2008 21:18:00 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Web Developer]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Travel]]></category>
		<category><![CDATA[Weather]]></category>
		<category><![CDATA[WP Geo]]></category>

		<guid isPermaLink="false">http://www.benhuson.co.uk/?p=492</guid>
		<description><![CDATA[Blair McMillan has just released a weather plugin for WordPress which works hand-in-hand with my WP Geo plugin. Designed for people who use their blog while traveling, Weather Traveller allows you to add weather information to the bottom of your posts so you can let your blog readers know what the weather is like in the [...]]]></description>
			<content:encoded><![CDATA[<p>Blair McMillan has just released a <a href="http://wordpress.org/extend/plugins/weather-traveller/">weather plugin for WordPress</a> which works hand-in-hand with my <a href="http://www.benhuson.co.uk/wordpress-plugins/wp-geo/">WP Geo plugin</a>.</p>
<p>Designed for people who use their blog while traveling, Weather Traveller allows you to add weather information to the bottom of your posts so you can let your blog readers know what the weather is like in the location you specify at the time you post.</p>
<p>For more information and to download the plugin visit:<br />
<a href="http://wordpress.org/extend/plugins/weather-traveller/">wordpress.org/extend/plugins/weather-traveller/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.benhuson.co.uk/2008/08/18/wordpress-weather-traveller-plugin/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Archive of Flash Player Versions</title>
		<link>http://www.benhuson.co.uk/2006/12/10/archive-of-flash-players/</link>
		<comments>http://www.benhuson.co.uk/2006/12/10/archive-of-flash-players/#comments</comments>
		<pubDate>Sun, 10 Dec 2006 14:17:45 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Web Developer]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Download]]></category>
		<category><![CDATA[Plugin]]></category>

		<guid isPermaLink="false">http://www.benhuson.com/2007/12/10/archive-of-flash-players/</guid>
		<description><![CDATA[Just stumbled across downloads of previous versions of Flash Player which available from the Adobe web site &#8211; handy if you&#8217;re developing Flash. There is also a Flash plugin uninstaller. If you&#8217;re not a developer, make sure you download the latest Flash plugin&#8230;]]></description>
			<content:encoded><![CDATA[<p>Just stumbled across downloads of previous versions of Flash Player which <a href="http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_14266" target="_blank">available from the Adobe web site</a> &#8211; handy if you&#8217;re developing Flash. There is also a Flash plugin uninstaller.</p>
<p>If you&#8217;re not a developer, make sure you download the latest Flash plugin&#8230;</p>
<p><a href="http://www.adobe.com/go/getflashplayer" target="_blank"><img id="image171" src="http://www.benhuson.com/wp-content/uploads/2007/01/get_flash_player.gif" alt="Get Flash Player" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.benhuson.co.uk/2006/12/10/archive-of-flash-players/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk (enhanced)

Served from: benhuson.co.uk @ 2010-09-10 16:54:10 -->