<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Xavisys</title> <link>http://xavisys.com</link> <description>WordPress Plugins and Custom WordPress Development</description> <lastBuildDate>Thu, 21 Jan 2010 20:22:34 +0000</lastBuildDate> <generator>http://wordpress.org/?v=2.9.2</generator> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Xavisys" /><feedburner:info uri="xavisys" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><title>The Xavisys WordPress Plugin Framework</title><link>http://feedproxy.google.com/~r/Xavisys/~3/MSJXcIzG0hU/</link> <comments>http://xavisys.com/xavisys-wordpress-plugin-framework/#comments</comments> <pubDate>Thu, 26 Nov 2009 02:16:18 +0000</pubDate> <dc:creator>AaronCampbell</dc:creator> <category><![CDATA[WordPress Plugins]]></category> <category><![CDATA[wordpress development]]></category><guid isPermaLink="false">http://xavisys.com/?p=779</guid> <description><![CDATA[A few months ago I was chatting with Joost de Valk and he was talking about a new plugin toolkit that he was making.  The basic idea was to make a flexible base that he could use to build on for all his plugins.  It would handle all the tasks that are common [...]]]></description> <content:encoded><![CDATA[<p>A few months ago I was chatting with <a
href="http://yoast.com">Joost de Valk</a> and he was talking about a new plugin toolkit that he was making.  The basic idea was to make a flexible base that he could use to build on for all his plugins.  It would handle all the tasks that are common to all his plugins (options page, dashboard widget, etc) and still be easily extended so each plugin could handle more specific tasks as well.  Now his plugins (at least some of them) use his toolkit.</p><p>It was a great idea, and I finally got around to writing one for my own plugins.  I built it as an abstract class (and a tiny CSS file) that I extend for each plugin.  Here you&#8217;ll get to see a quick tour of what the framework does.  Let me know in the comments if you&#8217;re interested in seeing a walkthrough of how it was built, and feel free to download <a
href="http://xavisys.com/wordpress-plugins/efficient-related-posts/">Efficient Related Posts</a> to see it in action.</p><p><span
id="more-779"></span></p><p>Here are some of the things it does:</p><ul><li>Stores plugin settings in a protected variable, making them easily available to all methods.</li><li>Registers the options for the plugin (making sure it works in WPMU and that options.php can handle updates to the options).</li><li>When an update to the plugin is available, it shows a changelog from the currently installed version to the newly available version (whether they&#8217;re one version apart or twenty).<br
/> <a
href="http://cdn.xavisys.com/wp-content/uploads/2009/11/erp-changelog1.png"><img
src="http://cdn.xavisys.com/wp-content/uploads/2009/11/erp-changelog1-600x214.png" alt="Changelog" title="Changelog" width="600" height="214" class="alignnone size-large wp-image-795" /></a></li><li>Adds an options page for the WordPress plugin settings, complete with a page heading and a Xavisys icon.</li><li>Styles the options page as two columns with meta boxes (similar to the two column dashboard layout).<br
/> <a
href="http://cdn.xavisys.com/wp-content/uploads/2009/11/erp-options-page1.png"><img
src="http://cdn.xavisys.com/wp-content/uploads/2009/11/erp-options-page1-600x587.png" alt="Options Page Screenshot" title="Options Page" width="600" height="587" class="alignnone size-large wp-image-797" /></a></li><li>Adds basic meta boxes to the sidebar of the options page, including one with a donate link, one with a link to the <a
href="/support/forum/">support forums</a>, and one showing the latest news from Xavisys.<br
/> <a
href="http://cdn.xavisys.com/wp-content/uploads/2009/11/erp-sidebar1.png"><img
src="http://xavisys.com/wp-content/uploads/2009/11/erp-sidebar1.png" alt="Sidebar screenshot" title="Sidebar" width="276" height="506" class="alignnone size-full wp-image-799" /></a></li><li>It adds links to the plugin row on the plugins page.  One link to the support forums and one to the plugin options page.<br
/> <a
href="http://cdn.xavisys.com/wp-content/uploads/2009/11/erp-plugin-row1.png"><img
src="http://cdn.xavisys.com/wp-content/uploads/2009/11/erp-plugin-row1-600x57.png" alt="Plugin Row Image" title="Plugin Row Links" width="600" height="57" class="alignnone size-large wp-image-798" /></a></li><li>It adds a dashboard widget with a feed from Xavisys, complete with the Xavisys logo and a way to subscribe via RSS to the Xavisys site.<br
/> <a
href="http://cdn.xavisys.com/wp-content/uploads/2009/11/dashboard-widget1.png"><img
src="http://cdn.xavisys.com/wp-content/uploads/2009/11/dashboard-widget1-600x297.png" alt="Xavisys Dashboard Image" title="Xavisys Dashboard Feed" width="600" height="297" class="alignnone size-large wp-image-794" /></a><br
/> <a
href="http://cdn.xavisys.com/wp-content/uploads/2009/11/dashboard-screen-options1.png"><img
src="http://cdn.xavisys.com/wp-content/uploads/2009/11/dashboard-screen-options1-600x215.png" alt="Dashboard Screen Options Image" title="Dashboard Screen Options" width="600" height="215" class="alignnone size-large wp-image-793" /></a></li></ul><p>It does all this based on variables set in the extending class.  For example, the setup for Efficient Related Posts looks something like this:</p><pre class="brush: php;">
require_once('xavisys-plugin-framework.php');
class efficientRelatedPosts extends XavisysPlugin {
	protected function _init() {
		$this-&gt;_hook = 'efficientRelatedPosts';
		$this-&gt;_file = plugin_basename( __FILE__ );
		$this-&gt;_pageTitle = __( 'Efficient Related Posts', $this-&gt;_slug );
		$this-&gt;_menuTitle = __( 'Related Posts', $this-&gt;_slug );
		$this-&gt;_accessLevel = 'manage_options';
		$this-&gt;_optionGroup = 'erp-options';
		$this-&gt;_optionNames = array('erp');
		$this-&gt;_optionCallbacks = array();
		$this-&gt;_slug = 'efficient-related-posts';
		$this-&gt;_paypalButtonId = '9996714';
	}
}
</pre><h3 class='related_post_title'>Related Posts:</h3><ul
class='related_post'><li><a
href='http://xavisys.com/10-great-wordpress-plugins/' title='10 Great WordPress Plugins'>10 Great WordPress Plugins</a></li><li><a
href='http://xavisys.com/wordpress-widget/' title='How To Make Your Own WordPress Widget'>How To Make Your Own WordPress Widget</a></li><li><a
href='http://xavisys.com/wordpress-core-canonical-plugins/' title='WordPress Core vs Canonical Plugins'>WordPress Core vs Canonical Plugins</a></li><li><a
href='http://xavisys.com/gpl-themes-love-plugins-suffer/' title='GPL Themes Get Some Love, Plugins Suffer?'>GPL Themes Get Some Love, Plugins Suffer?</a></li><li><a
href='http://xavisys.com/wordpress-developer-meeting-july-01-2009/' title='WordPress Developer Meeting &#8211; July 01, 2009'>WordPress Developer Meeting &#8211; July 01, 2009</a></li></ul> <img src="http://feeds.feedburner.com/~r/Xavisys/~4/MSJXcIzG0hU" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://xavisys.com/xavisys-wordpress-plugin-framework/feed/</wfw:commentRss> <slash:comments>6</slash:comments> <feedburner:origLink>http://xavisys.com/xavisys-wordpress-plugin-framework/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=xavisys-wordpress-plugin-framework</feedburner:origLink></item> <item><title>Efficient Related Posts 0.3.4 Released</title><link>http://feedproxy.google.com/~r/Xavisys/~3/PPg-vmJzKAs/</link> <comments>http://xavisys.com/efficient-related-posts-0-3-4-released/#comments</comments> <pubDate>Wed, 25 Nov 2009 23:43:09 +0000</pubDate> <dc:creator>AaronCampbell</dc:creator> <category><![CDATA[WordPress Plugin Updates]]></category> <category><![CDATA[Efficient Related Posts]]></category> <category><![CDATA[WordPress Plugins]]></category><guid isPermaLink="false">http://xavisys.com/?p=781</guid> <description><![CDATA[We just released version 0.3.4 of the Efficient Related Posts plugin for WordPress.  It uses the new Xavisys Plugin Framwork (I&#8217;ll post more info on that soon), which gives it a nice new options page, links to the support forums, etc.  We also did a lot of the work toward internationalizing it, and [...]]]></description> <content:encoded><![CDATA[<p>We just released version 0.3.4 of the <a
href="http://xavisys.com/wordpress-plugins/efficient-related-posts/">Efficient Related Posts plugin for WordPress</a>.  It uses the new Xavisys Plugin Framwork (I&#8217;ll post more info on that soon), which gives it a nice new options page, links to the support forums, etc.  We also did a lot of the work toward internationalizing it, and hopefully it will be fully translatable int he next version (coming soon).</p><p>If you want to request a feature, or need support, go to the <a
href="http://xavisys.com/support/forum/efficient-related-posts/">Efficient Related Posts Support Forum</a>.  More information is available on the <a
href="http://xavisys.com/wordpress-plugins/efficient-related-posts/">Efficient Related Posts</a> page.<br
/><h3 class='related_post_title'>Related Posts:</h3><ul
class='related_post'><li><a
href='http://xavisys.com/problem-related-post-plugins/' title='The Problem with Related Post Plugins'>The Problem with Related Post Plugins</a></li><li><a
href='http://xavisys.com/xavisys-wordpress-plugin-framework/' title='The Xavisys WordPress Plugin Framework'>The Xavisys WordPress Plugin Framework</a></li><li><a
href='http://xavisys.com/10-great-wordpress-plugins/' title='10 Great WordPress Plugins'>10 Great WordPress Plugins</a></li><li><a
href='http://xavisys.com/wordpress-plugins/manual-related-links/' title='Manual Related Links'>Manual Related Links</a></li><li><a
href='http://xavisys.com/wordpress-plugins/efficient-related-posts/' title='Efficient Related Posts'>Efficient Related Posts</a></li></ul> <span
class="sfforumlink"><a
href="http://xavisys.com/support/forum/efficient-related-posts/efficient-related-posts-0-3-4-released/"><img
src="http://xavisys.com/wp-content/plugins/simple-forum/styles/icons/default/bloglink.png" alt="" /> Join the forum discussion on this post</a> - (1) Posts</span><img src="http://feeds.feedburner.com/~r/Xavisys/~4/PPg-vmJzKAs" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://xavisys.com/efficient-related-posts-0-3-4-released/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <feedburner:origLink>http://xavisys.com/efficient-related-posts-0-3-4-released/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=efficient-related-posts-0-3-4-released</feedburner:origLink></item> <item><title>Twitter Widget Pro 2.1.3 Released</title><link>http://feedproxy.google.com/~r/Xavisys/~3/cw4KCz0JDUs/</link> <comments>http://xavisys.com/twitter-widget-pro-2-1-3-released/#comments</comments> <pubDate>Wed, 18 Nov 2009 15:12:29 +0000</pubDate> <dc:creator>AaronCampbell</dc:creator> <category><![CDATA[WordPress Plugin Updates]]></category> <category><![CDATA[twitter]]></category> <category><![CDATA[Twitter Widget Pro]]></category> <category><![CDATA[WordPress Plugins]]></category><guid isPermaLink="false">http://xavisys.com/?p=766</guid> <description><![CDATA[The new Twitter Widget Pro support forum has turned up some great ideas and has helped catch some easily missed bugs.  This latest release of Twitter Widget Pro includes a bugfix that removes a duplicate closing tag for the title link, which was caught by someone in the forums, as well as an enhancement [...]]]></description> <content:encoded><![CDATA[<p>The new <a
href="http://xavisys.com/support/forum/twitter-widget-pro/">Twitter Widget Pro support forum</a> has turned up some great ideas and has helped catch some easily missed bugs.  This latest release of <a
href="http://xavisys.com/wordpress-plugins/wordpress-twitter-widget/">Twitter Widget Pro</a> includes a bugfix that removes a duplicate closing tag for the title link, which was caught by someone in the forums, as well as an enhancement that makes the date format a per-widget setting (also suggested int he forums).</p><p>If you want to request a feature, or need support, go to the <a
href="http://xavisys.com/support/forum/twitter-widget-pro/">Twitter Widget Pro Forum</a>.  For more information, go to the <a
href="http://xavisys.com/wordpress-plugins/wordpress-twitter-widget/">Twitter Widget Pro</a> page.<br
/><h3 class='related_post_title'>Related Posts:</h3><ul
class='related_post'><li><a
href='http://xavisys.com/10-great-wordpress-plugins/' title='10 Great WordPress Plugins'>10 Great WordPress Plugins</a></li><li><a
href='http://xavisys.com/xavisys-wordpress-plugin-framework/' title='The Xavisys WordPress Plugin Framework'>The Xavisys WordPress Plugin Framework</a></li><li><a
href='http://xavisys.com/wordpress-plugins/wordpress-twitter-widget/' title='Twitter Widget Pro'>Twitter Widget Pro</a></li><li><a
href='http://xavisys.com/gpl-themes-love-plugins-suffer/' title='GPL Themes Get Some Love, Plugins Suffer?'>GPL Themes Get Some Love, Plugins Suffer?</a></li><li><a
href='http://xavisys.com/problem-related-post-plugins/' title='The Problem with Related Post Plugins'>The Problem with Related Post Plugins</a></li></ul> <img src="http://feeds.feedburner.com/~r/Xavisys/~4/cw4KCz0JDUs" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://xavisys.com/twitter-widget-pro-2-1-3-released/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <feedburner:origLink>http://xavisys.com/twitter-widget-pro-2-1-3-released/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=twitter-widget-pro-2-1-3-released</feedburner:origLink></item> <item><title>Twitter Widget Pro 2.1.2 Released</title><link>http://feedproxy.google.com/~r/Xavisys/~3/ctNW_utcqbY/</link> <comments>http://xavisys.com/twitter-widget-pro-2-1-2-released/#comments</comments> <pubDate>Sun, 15 Nov 2009 16:37:40 +0000</pubDate> <dc:creator>AaronCampbell</dc:creator> <category><![CDATA[WordPress Plugin Updates]]></category> <category><![CDATA[twitter]]></category> <category><![CDATA[Twitter Widget Pro]]></category> <category><![CDATA[WordPress Plugins]]></category><guid isPermaLink="false">http://xavisys.com/?p=762</guid> <description><![CDATA[There was a small formatting issue introduced in Twitter Widget Pro 2.1.0 where there were no spaces between the tweet and meta data or between the date of the tweet and where the tweet was from (such as &#8220;from TweetDeck&#8221;).  When I added the shortcode functionality I had to remove a lot of the [...]]]></description> <content:encoded><![CDATA[<p>There was a small formatting issue introduced in Twitter Widget Pro 2.1.0 where there were no spaces between the tweet and meta data or between the date of the tweet and where the tweet was from (such as &#8220;from TweetDeck&#8221;).  When I added the shortcode functionality I had to remove a lot of the excess whitespace so that the formatting built in to WordPress didn&#8217;t mess up the formatting of the widget when it was embedded in a post or page.  I just released version 2.1.2 that fixed the spacing without messing up the formatting for the shortcodes.</p><p>I also added in some links to the <a
href="http://xavisys.com/support/forum/twitter-widget-pro/">WordPress Twitter Widget Pro Support Forum</a> to make it easier for you to ask questions or make suggestions or requests.  For more information, go to the <a
href="http://xavisys.com/wordpress-plugins/wordpress-twitter-widget/">Twitter Widget Pro</a> page.<br
/><h3 class='related_post_title'>Related Posts:</h3><ul
class='related_post'><li><a
href='http://xavisys.com/10-great-wordpress-plugins/' title='10 Great WordPress Plugins'>10 Great WordPress Plugins</a></li><li><a
href='http://xavisys.com/xavisys-wordpress-plugin-framework/' title='The Xavisys WordPress Plugin Framework'>The Xavisys WordPress Plugin Framework</a></li><li><a
href='http://xavisys.com/wordpress-plugins/wordpress-twitter-widget/' title='Twitter Widget Pro'>Twitter Widget Pro</a></li><li><a
href='http://xavisys.com/gpl-themes-love-plugins-suffer/' title='GPL Themes Get Some Love, Plugins Suffer?'>GPL Themes Get Some Love, Plugins Suffer?</a></li><li><a
href='http://xavisys.com/problem-related-post-plugins/' title='The Problem with Related Post Plugins'>The Problem with Related Post Plugins</a></li></ul> <span
class="sfforumlink"><a
href="http://xavisys.com/support/forum/twitter-widget-pro/twitter-widget-pro-2-1-2-released/"><img
src="http://xavisys.com/wp-content/plugins/simple-forum/styles/icons/default/bloglink.png" alt="" /> Join the forum discussion on this post</a> - (5) Posts</span><img src="http://feeds.feedburner.com/~r/Xavisys/~4/ctNW_utcqbY" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://xavisys.com/twitter-widget-pro-2-1-2-released/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <feedburner:origLink>http://xavisys.com/twitter-widget-pro-2-1-2-released/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=twitter-widget-pro-2-1-2-released</feedburner:origLink></item> <item><title>Twitter Widget Pro 2.1.1 Released</title><link>http://feedproxy.google.com/~r/Xavisys/~3/34kC4ZiYxpE/</link> <comments>http://xavisys.com/twitter-widget-pro-2-1-1-released/#comments</comments> <pubDate>Fri, 13 Nov 2009 21:51:59 +0000</pubDate> <dc:creator>AaronCampbell</dc:creator> <category><![CDATA[WordPress Plugin Updates]]></category> <category><![CDATA[twitter]]></category> <category><![CDATA[Twitter Widget Pro]]></category> <category><![CDATA[WordPress Plugins]]></category><guid isPermaLink="false">http://xavisys.com/?p=757</guid> <description><![CDATA[Recently, a Twitter Widget Pro user (alx) asked on the support forum for a new feature.  He wanted to be able to have all the links open in a new window, and that&#8217;s a great idea!  I just released version 2.1.1 of Twitter Widget Pro with this exact feature.  If you want [...]]]></description> <content:encoded><![CDATA[<p>Recently, a Twitter Widget Pro user (alx) <a
href="http://xavisys.com/support/forum/twitter-widget-pro/open-links-in-new-window/">asked on the support forum for a new feature</a>.  He wanted to be able to have all the links open in a new window, and that&#8217;s a great idea!  I just released version 2.1.1 of <a
href="http://xavisys.com/wordpress-plugins/wordpress-twitter-widget/">Twitter Widget Pro</a> with this exact feature.  If you want to request a feature, or need support, go to the <a
href="http://xavisys.com/support/forum/twitter-widget-pro/">Twitter Widget Pro Forum</a>.  For more information, go to the <a
href="http://xavisys.com/wordpress-plugins/wordpress-twitter-widget/">Twitter Widget Pro</a> page.<br
/><h3 class='related_post_title'>Related Posts:</h3><ul
class='related_post'><li><a
href='http://xavisys.com/10-great-wordpress-plugins/' title='10 Great WordPress Plugins'>10 Great WordPress Plugins</a></li><li><a
href='http://xavisys.com/xavisys-wordpress-plugin-framework/' title='The Xavisys WordPress Plugin Framework'>The Xavisys WordPress Plugin Framework</a></li><li><a
href='http://xavisys.com/wordpress-plugins/wordpress-twitter-widget/' title='Twitter Widget Pro'>Twitter Widget Pro</a></li><li><a
href='http://xavisys.com/gpl-themes-love-plugins-suffer/' title='GPL Themes Get Some Love, Plugins Suffer?'>GPL Themes Get Some Love, Plugins Suffer?</a></li><li><a
href='http://xavisys.com/problem-related-post-plugins/' title='The Problem with Related Post Plugins'>The Problem with Related Post Plugins</a></li></ul> <img src="http://feeds.feedburner.com/~r/Xavisys/~4/34kC4ZiYxpE" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://xavisys.com/twitter-widget-pro-2-1-1-released/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <feedburner:origLink>http://xavisys.com/twitter-widget-pro-2-1-1-released/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=twitter-widget-pro-2-1-1-released</feedburner:origLink></item> <item><title>10 Great WordPress Plugins</title><link>http://feedproxy.google.com/~r/Xavisys/~3/31SsL7woD9g/</link> <comments>http://xavisys.com/10-great-wordpress-plugins/#comments</comments> <pubDate>Thu, 12 Nov 2009 08:00:23 +0000</pubDate> <dc:creator>AaronCampbell</dc:creator> <category><![CDATA[WordPress Plugins]]></category> <category><![CDATA[Akismet]]></category> <category><![CDATA[Clean Slugs]]></category> <category><![CDATA[Google XML Sitemaps]]></category> <category><![CDATA[Headspace2]]></category> <category><![CDATA[Simple Trackback Validation]]></category> <category><![CDATA[Sociable]]></category> <category><![CDATA[Subscribe to Comments]]></category> <category><![CDATA[Twitter Tools]]></category> <category><![CDATA[Twitter Widget Pro]]></category> <category><![CDATA[WP Super Cache]]></category><guid isPermaLink="false">http://wpinformer.com/?p=26</guid> <description><![CDATA[One of the greatest things about WordPress is how extensible it is through it&#8217;s plugin system.  There&#8217;s a plugin for almost everything.  There are more than 4,400 plugins just in the WordPress.org Plugin Directory and there are plenty more that aren&#8217;t in the directory.  Unfortunately, sometimes there are so many plugins that [...]]]></description> <content:encoded><![CDATA[<p>One of the greatest things about WordPress is how extensible it is through it&#8217;s plugin system.  There&#8217;s a plugin for almost everything.  There are more than 4,400 plugins just in the <a
href="http://wordpress.org/extend/plugins/">WordPress.org Plugin Directory</a> and there are plenty more that aren&#8217;t in the directory.  Unfortunately, sometimes there are so many plugins that it makes it hard to find the best WordPress plugins in the massive sea of options.  Here are some of my favorite overall plugins.</p><ol><li><a
href="http://akismet.com/">Akismet</a></li><li><a
href="http://sw-guide.de/wordpress/plugins/simple-trackback-validation/">Simple Trackback Validation</a></li><li><a
href="http://urbangiraffe.com/plugins/headspace2/">Headspace2</a></li><li><a
href="http://yoast.com/wordpress/">Clean Slugs</a></li><li><a
href="http://www.arnebrachhold.de/projects/wordpress-plugins/google-xml-sitemaps-generator/">Google XML Sitemaps</a></li><li><a
href="http://xavisys.com/2008/04/wordpress-twitter-widget/">Twitter Widget Pro</a></li><li><a
href="http://ocaoimh.ie/wp-super-cache/">WP Super Cache</a></li><li><a
href="http://yoast.com/wordpress/sociable/">Sociable</a></li><li><a
href="http://txfx.net/code/wordpress/subscribe-to-comments/">Subscribe to Comments</a></li><li><a
href="http://alexking.org/projects/wordpress">Twitter Tools</a></li></ol><p><span
id="more-26"></span></p><h3><a
href="http://wordpress.org/extend/plugins/akismet/">Akismet</a></h3><p>Akismet is the only useful plugin that ships with WordPress (so to speak).  It requires that you sign up for an API key, but it&#8217;s well worth it.  Comment spam is a huge problem on any site that allows comments.  The WordPress Akismet plugin checks your comments against the Akismet web service to see if they look like spam or not and lets you review the spam it catches under your blog&#8217;s &#8220;Comments&#8221; admin screen.  It&#8217;s actually quite effective, more than most (if not all) the other comment spam plugins I&#8217;ve tried.</p><h3><a
href="http://wordpress.org/extend/plugins/simple-trackback-validation/">Simple Trackback Validation</a></h3><p>Fighting spam is the never ending task of anyone running a site that allows user content of any kind.  Akismet does a great job of handling the comment spam, but Simple Trackback Validation fills in the gaps and handles trackbacks.  Simple Trackback Validation Plugin performs a simple but very effective test on all incoming trackbacks in order to stop trackback spam.  Basically, it makes sure that the page claiming to be posting a trackback actually links to the page it&#8217;s posting that trackback to.</p><h3><a
href="http://wordpress.org/extend/plugins/headspace2/">Headspace2</a></h3><p>WordPress is pretty good with search engine optimization right out of the box, just by turning on permalinks.  However, there&#8217;s definitely plenty of room for improvement.  HeadSpace2 is an all-in-one meta-data manager that allows you to fine-tune the SEO potential of your site.  Headspace will help you to better handle your tags/keywords, meta descriptions, and it does a great job of cleaning up and customizing your title tag.  No longer do you need a bunch of conditionals in your title tag.  A simple wp_title(&#8221;) will suffice, and the rest can be handled by Headspace2.</p><h3><a
href="http://yoast.com/wordpress/">Clean Slugs</a></h3><p>Another plugin that will help you get a little better search engine optimization.  Joost&#8217;s Clean Slugs plugin looks for and removes more than 650 &#8220;stop words&#8221; from your post or page title when the slug is created.  These are words that most search engines ignore because they are inconsequential, so removing them will help your raking.  Unlike all the other plugins on this list, this plugin can&#8217;t be downloaded from the Wordpress.org repository.  To get this plugin, simply sign up for Joost&#8217;s WordPress Newsletter.</p><h3><a
href="http://wordpress.org/extend/plugins/google-sitemap-generator/">Google XML Sitemaps</a></h3><p>While it&#8217;s true that search engines can spider or crawl your site by following links, having a proper XML sitemap allows you to make sure that every post/page is properly indexed, as well as letting you specify a priority level for each.  This plugin will create a Google sitemaps compliant XML-Sitemap of your WordPress blog. It supports all of the WordPress generated pages as well as custom ones. Everytime you edit or create a post, your sitemap is updated and all major search engines that support the sitemap protocol, like ASK.com, Google, MSN Search and YAHOO, are notified about the update.</p><h3><a
href="http://wordpress.org/extend/plugins/twitter-widget-pro/">Twitter Widget Pro</a></h3><p>Twitter offer javascript widgets that display your latest tweets, but there are a couple problems.  First, you need to be able to modify your theme or put the code into a text widget.  Secondly, since it&#8217;s javascript, search engines don&#8217;t see the content.  Twitter Widget Pro is a widget that properly handles twitter feeds, including @username and link parsing. It supports displaying profiles images, and even lets you control whether to display the time and date of a tweet or how log ago it happened (about 5 hours ago, etc).  It does all this as a server-side widget, so the content can all be parsed by search engines.  Requires PHP5.</p><h3><a
href="http://wordpress.org/extend/plugins/wp-super-cache/">WP Super Cache</a></h3><p>WP Super Cache is a static caching plugin for WordPress. It generates html files that are served directly by Apache without processing comparatively heavy PHP scripts. By using this plugin you will speed up your WordPress blog significantly, reduce CPU/memory usage, and lessen database strain.  If you have a high-traffic WordPress site, this is absolutely necessary.</p><h3><a
href="http://wordpress.org/extend/plugins/sociable/">Sociable</a></h3><p>Social marketing is a hot topic and many have found that it&#8217;s incredibly successful.  There are a few plugins for WordPress that will help you with this.  Add This, Share This, and Sociable are the most popular, and I think Sociable is the best.  It&#8217;s the only one that allows all content to be loaded from your site, no scipts or images to load from some other site.  The reason this is so important to me is that I don&#8217;t ever want my site to load slowly because of a different site.  Sociable automatically add links to your favorite social bookmarking sites on your posts, pages and in your RSS feed. You can choose from 99 different social bookmarking sites!</p><h3><a
href="http://wordpress.org/extend/plugins/subscribe-to-comments/">Subscribe to Comments</a></h3><p>Getting people to comment on your posts can be a challenge.  Even more difficult is getting people to come back to the same post and continue a discussion.  Subscribe to Comments is a robust plugin that enables commenters to sign up for e-mail notification of subsequent entries. The plugin includes a full-featured subscription manager that your commenters can use to unsubscribe to certain posts, block all notifications, or even change their notification e-mail address!</p><h3><a
href="http://wordpress.org/extend/plugins/twitter-tools/">Twitter Tools</a></h3><p>Twitter Tools is a plugin that creates a complete integration between your WordPress blog and your Twitter account.  The only part of it that I use is the ability to automatically notify Twitter of new posts.  The problem is that it prefaces all these Tweets with &#8220;New blog post:&#8221; and this text isn&#8217;t customizable.  Additionally, it uses tinyurl to shorten the URL for the post, and I would prefer that it let me use something like SnipUrl which lets me track the number of clicks.  Still, the fact that it&#8217;s all automatic saves a lot of time for me, especially on sites like <a
href="http://webdevnews.net" title="News for Web Developers">Web Developer News</a> where people other than me post articles on a regular basis.<br
/><h3 class='related_post_title'>Related Posts:</h3><ul
class='related_post'><li><a
href='http://xavisys.com/xavisys-wordpress-plugin-framework/' title='The Xavisys WordPress Plugin Framework'>The Xavisys WordPress Plugin Framework</a></li><li><a
href='http://xavisys.com/wordpress-plugins/wordpress-twitter-widget/' title='Twitter Widget Pro'>Twitter Widget Pro</a></li><li><a
href='http://xavisys.com/gpl-themes-love-plugins-suffer/' title='GPL Themes Get Some Love, Plugins Suffer?'>GPL Themes Get Some Love, Plugins Suffer?</a></li><li><a
href='http://xavisys.com/problem-related-post-plugins/' title='The Problem with Related Post Plugins'>The Problem with Related Post Plugins</a></li></ul> <img src="http://feeds.feedburner.com/~r/Xavisys/~4/31SsL7woD9g" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://xavisys.com/10-great-wordpress-plugins/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <feedburner:origLink>http://xavisys.com/10-great-wordpress-plugins/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=10-great-wordpress-plugins</feedburner:origLink></item> <item><title>Twitter Widget Pro 2.1.0 Released</title><link>http://feedproxy.google.com/~r/Xavisys/~3/aB0u6qm-NNM/</link> <comments>http://xavisys.com/twitter-widget-pro-2-1-0-released/#comments</comments> <pubDate>Thu, 12 Nov 2009 00:38:57 +0000</pubDate> <dc:creator>AaronCampbell</dc:creator> <category><![CDATA[WordPress Plugin Updates]]></category> <category><![CDATA[twitter]]></category> <category><![CDATA[Twitter Widget Pro]]></category> <category><![CDATA[WordPress Plugins]]></category><guid isPermaLink="false">http://xavisys.com/?p=746</guid> <description><![CDATA[I just tagged a new version of Twitter Widget Pro which includes an oft-requested feature, a twitter-widget shortcode.  You can now embed a twitter widget into any post or page by simply dropping in a shortcode like [] to embed a widget like this:
To read more about how to use the shortcodes and to [...]]]></description> <content:encoded><![CDATA[<p>I just tagged a new version of <a
href="http://xavisys.com/wordpress-plugins/wordpress-twitter-widget/">Twitter Widget Pro</a> which includes an oft-requested feature, a twitter-widget shortcode.  You can now embed a twitter widget into any post or page by simply dropping in a shortcode like [twitter-widget username="xavisys"] to embed a widget like this:</p><div
class="widget_twitter"><div><br
/><h2><a
class="twitterwidget twitterwidget-title" title="Twitter: xavisys" href="http://twitter.com/xavisys">Tweets from Xavisys</a></h2><p><ul><li><span
class='entry-content'><a
href="http://twitter.com/chrisorourke" class="twitter-user">@chrisorourke</a> Very few, possibly none.  The scans look for SQL injection, XSS vulnerabilities, etc.  Most exploits aren't browser-specific</span> <span
class='entry-meta'><span
class='time-meta'><a
href="http://twitter.com/xavisys/statuses/9560731229">about 12 hours ago</a></span> <span
class='from-meta'>from <a
href="http://www.seesmic.com/" rel="nofollow">Seesmic</a></span><span
class="in-reply-to-meta"><a
href="http://twitter.com/chrisorourke/statuses/9551779765" class="reply-to">in reply to chrisorourke</a></span></span></li><li><span
class='entry-content'>I think I have a new record: an Acunetix security scan gave a 2871 page report in PDF format!  That's a LOT of cleanup!</span> <span
class='entry-meta'><span
class='time-meta'><a
href="http://twitter.com/xavisys/statuses/9551670638">about 15 hours ago</a></span> <span
class='from-meta'>from <a
href="http://www.seesmic.com/" rel="nofollow">Seesmic</a></span></span></li><li><span
class='entry-content'><a
href="http://twitter.com/kcortez" class="twitter-user">@kcortez</a> Those options are working fine on my sites.  Head over to <a
href="http://xavisys.com/support/forum/">http://xavisys.com/support/forum/</a> and ask in more detail there.</span> <span
class='entry-meta'><span
class='time-meta'><a
href="http://twitter.com/xavisys/statuses/8856327866">02:27:43 PM February 09, 2010</a></span> <span
class='from-meta'>from <a
href="http://www.seesmic.com/" rel="nofollow">Seesmic</a></span><span
class="in-reply-to-meta"><a
href="http://twitter.com/kcortez/statuses/8819183261" class="reply-to">in reply to kcortez</a></span></span></li></ul></div></div><p><p>To read more about how to use the shortcodes and to download the plugin, go to the <a
href="http://xavisys.com/wordpress-plugins/wordpress-twitter-widget/">Twitter Widget Pro</a> page.  For support, go to the <a
href="http://xavisys.com/support/forum/twitter-widget-pro/">Twitter Widget Pro Forum</a><br
/><h3 class='related_post_title'>Related Posts:</h3><ul
class='related_post'><li><a
href='http://xavisys.com/10-great-wordpress-plugins/' title='10 Great WordPress Plugins'>10 Great WordPress Plugins</a></li><li><a
href='http://xavisys.com/xavisys-wordpress-plugin-framework/' title='The Xavisys WordPress Plugin Framework'>The Xavisys WordPress Plugin Framework</a></li><li><a
href='http://xavisys.com/wordpress-plugins/wordpress-twitter-widget/' title='Twitter Widget Pro'>Twitter Widget Pro</a></li><li><a
href='http://xavisys.com/gpl-themes-love-plugins-suffer/' title='GPL Themes Get Some Love, Plugins Suffer?'>GPL Themes Get Some Love, Plugins Suffer?</a></li><li><a
href='http://xavisys.com/problem-related-post-plugins/' title='The Problem with Related Post Plugins'>The Problem with Related Post Plugins</a></li></ul> <img src="http://feeds.feedburner.com/~r/Xavisys/~4/aB0u6qm-NNM" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://xavisys.com/twitter-widget-pro-2-1-0-released/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <feedburner:origLink>http://xavisys.com/twitter-widget-pro-2-1-0-released/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=twitter-widget-pro-2-1-0-released</feedburner:origLink></item> <item><title>CSS Trick: Turning a background image into a clickable link</title><link>http://feedproxy.google.com/~r/Xavisys/~3/YdPV0QG6yPo/</link> <comments>http://xavisys.com/css-trick-turning-a-background-image-into-a-clickable-link/#comments</comments> <pubDate>Wed, 11 Nov 2009 01:32:05 +0000</pubDate> <dc:creator>AaronCampbell</dc:creator> <category><![CDATA[CSS]]></category> <category><![CDATA[Web Design]]></category><guid isPermaLink="false">http://xavisys.com/?p=733</guid> <description><![CDATA[One of the things I most often get asked by people trying to master HTML and CSS is &#8220;How do I make a background image clickable?&#8221;  It&#8217;s easy to wrap a regular image tag in a link, but what if your design or situation required that you use a background image?  It&#8217;s actually [...]]]></description> <content:encoded><![CDATA[<p>One of the things I most often get asked by people trying to master HTML and CSS is &#8220;How do I make a background image clickable?&#8221;  It&#8217;s easy to wrap a regular image tag in a link, but what if your design or situation required that you use a background image?  It&#8217;s actually quite simple.  Just follow these steps and I&#8217;ll show you how to make a clickable background image like this:</p><p><a
href="http://xavisys.com" title="Professional WordPress Development" style="background-image:url(/wp-content/uploads/2009/11/email_logo.gif);display:block;height:58px;text-indent:-9999px;width:200px;">Xavisys Website Development</a></p><p><span
id="more-733"></span></p><p>Start with just a link exactly as you would make it for any other purpose, and make sure to give the link an id so that we can use that to apply our styles:</p><pre class="brush: xml;">&lt;a href=&quot;http://xavisys.com&quot; title=&quot;Professional WordPress Development&quot; id=&quot;xavisys-logo&quot;&gt;Xavisys Website Development&lt;/a&gt;</pre><p>That&#8217;s all the (X)HTML you&#8217;ll need to make your background image clickable.  Your link should look something like this: <a
href="http://xavisys.com" title="Professional WordPress Development" id="xavisys-logo">Xavisys Website Development</a></p><p>So, how can we make a background image a clickable link? It turns out it can be done with a clever CSS trick.  Let&#8217;s get started by adding the background image and make the link the same size as the image (so you can see the whole image).  Since an anchor tag isn&#8217;t a block level element, we need to force it to display as &#8220;block&#8221; so that we can specify the size:</p><pre class="brush: css;">
#xavisys-logo {
	background-image:url(/wp-content/uploads/2009/11/email_logo.gif);
	display:block;
	height:58px;
	width:200px;
}
</pre><p>At this point it should look something like this: <a
href="http://xavisys.com" title="Professional WordPress Development" style="background-image:url(/wp-content/uploads/2009/11/email_logo.gif); width:200px; height:58px; display:block;">Xavisys Website Development</a></p><p>Now all we need to do is hide the text.  This can be done using &#8220;text-indent&#8221; and indenting the text completely off the screen like this:</p><pre class="brush: css; highlight: [5];">
#xavisys-logo {
	background-image:url(/wp-content/uploads/2009/11/email_logo.gif);
	display:block;
	height:58px;
	text-indent:-9999px;
	width:200px;
}
</pre><p>And the finished product looks like this: <a
href="http://xavisys.com" title="Professional WordPress Development" style="background-image:url(/wp-content/uploads/2009/11/email_logo.gif);display:block;height:58px;text-indent:-9999px;width:200px;">Xavisys Website Development</a></p><p>And there you have it – a quick CSS trick with clean markup that turns your background images into clickable links.  The best thing is, these don&#8217;t adversely affect your <abbr
title="Search Engine Optimization">SEO</abbr> and can even be easily used inside of header tags if needed!<br
/><h3 class='related_post_title'>Related Posts:</h3><ul
class='related_post'><li><a
href='http://xavisys.com/becoming-a-freelance-web-developerdesigner/' title='Becoming a Freelance Web Developer/Designer'>Becoming a Freelance Web Developer/Designer</a></li><li><a
href='http://xavisys.com/new-web-development-resource-launched/' title='New Web Development Resource Launched'>New Web Development Resource Launched</a></li><li><a
href='http://xavisys.com/free-template-minimalist/' title='Free Template: Minimalist'>Free Template: Minimalist</a></li><li><a
href='http://xavisys.com/free-template-bluebox/' title='Free Template: BlueBox'>Free Template: BlueBox</a></li><li><a
href='http://xavisys.com/dilbert/' title='Dilbert'>Dilbert</a></li></ul> <img src="http://feeds.feedburner.com/~r/Xavisys/~4/YdPV0QG6yPo" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://xavisys.com/css-trick-turning-a-background-image-into-a-clickable-link/feed/</wfw:commentRss> <slash:comments>28</slash:comments> <feedburner:origLink>http://xavisys.com/css-trick-turning-a-background-image-into-a-clickable-link/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=css-trick-turning-a-background-image-into-a-clickable-link</feedburner:origLink></item> <item><title>How To Make Your Own WordPress Widget</title><link>http://feedproxy.google.com/~r/Xavisys/~3/NcDe5vJZnK4/</link> <comments>http://xavisys.com/wordpress-widget/#comments</comments> <pubDate>Mon, 09 Nov 2009 18:45:26 +0000</pubDate> <dc:creator>AaronCampbell</dc:creator> <category><![CDATA[WordPress Widgets]]></category> <category><![CDATA[wordpress development]]></category> <category><![CDATA[Wordpress]]></category> <category><![CDATA[WordPress 2.8]]></category> <category><![CDATA[WordPress Howto]]></category><guid isPermaLink="false">http://wpinformer.com/?p=44</guid> <description><![CDATA[In this article, I&#8217;m going to show you how to write a simple plugin that adds a new widget to WordPress.  We&#8217;ll be using the new WP_Widget class, which is the newest method but means that the widget will only work in WordPress 2.8+.  I know that 2.8 isn&#8217;t actually out yet, but [...]]]></description> <content:encoded><![CDATA[<p>In this article, I&#8217;m going to show you how to write a simple plugin that adds a new widget to WordPress.  We&#8217;ll be using the new WP_Widget class, which is the newest method but means that the widget will only work in WordPress 2.8+.  I know that 2.8 isn&#8217;t actually out yet, but it will be soon and there&#8217;s no sense in learning the old method.</p><p>The widget we&#8217;ll be creating will display upcoming posts (scheduled posts).  A lot of sites schedule posts to automatically publish at a specific time, helping them keep a steady flow of articles.  I know that I use this trick on <a
href="http://webdevnews.net">Web Developer News</a> and <a
href="http://www.attackr.com">Attackr</a>, and I&#8217;ll use it on this site as soon as I get some more articles written.  Since the articles are already there and ready to be posted, why not tease them and give your readers something to look forward to?  That&#8217;s exactly what this widget will do.</p><p><span
id="more-44"></span></p><p>To start, you need to create a class for your widget that that extends WP_Widget.  We&#8217;ll be using WP_Widget_Upcoming_Posts.  Then you should hook into the widgets_init action and use register_widget() to register your new widget.  The bare bones skeleton looks like this (and does nothing but throw a warning):</p><pre class="brush: php;">
/**
 * Upcoming_Posts widget class
 */
class WP_Widget_Upcoming_Posts extends WP_Widget {
	// Our Widget methods will go here
}
function registerUpcomingPostsWidget() {
	register_widget('WP_Widget_Upcoming_Posts');
}
add_action('widgets_init', 'registerUpcomingPostsWidget');
</pre><p>Now, there are a few methods that you need to create.  The first needs to be named the same as the class (WP_Widget_Upcoming_Posts in this case), which will be used to instantiate the widget.  Do not use the PHP5 __construct, as the WP_Widget class uses that and you end up with an infinite loop if you do.  Second, you must create a widget method, which is used to actually manage and display your widget.  In our case we&#8217;ll also be overloading the update method to handle updates to widget settings and the form method which is used to display the setting form on the widget admin page.  I&#8217;m going to go through each method, explain the code, and then put it all together.</p><p>First, the WP_Widget_Upcoming_Posts method:</p><pre class="brush: php;">
function WP_Widget_Upcoming_Posts() {
	$widget_ops = array('classname' =&gt; 'widget_upcoming_entries', 'description' =&gt; __( &quot;List scheduled/upcoming posts&quot;, 'upcoming_posts_widget') );
	$this-&gt;WP_Widget('upcoming-posts', __('Upcoming Posts', 'upcoming_posts_widget'), $widget_ops);
}
</pre><p>First, we set up the options for the widget.  We set the classname to widget_upcoming_posts.  This will be added to the li tag of the widget when it&#8217;s displayed.  We also set the description, which is displayed when the widget box is expanded in the available widgets section of the new widgets admin page.  These options are passed to WP_Widget along with the id base (upcoming-posts) and the widget name (Upcoming Posts).</p><pre class="brush: php;">
function widget($args, $instance) {
	extract($args);

	$title = empty($instance['title']) ? __('Upcoming Posts', 'upcoming_posts_widget') : apply_filters('widget_title', $instance['title']);
	if ( !$number = (int) $instance['number'] )
		$number = 10;
	else if ( $number &lt; 1 )
		$number = 1;
	else if ( $number &gt; 15 )
		$number = 15;

	$queryArgs = array(
		'showposts'			=&gt; $number,
		'what_to_show'		=&gt; 'posts',
		'nopaging'			=&gt; 0,
		'post_status'		=&gt; 'future',
		'caller_get_posts'	=&gt; 1,
		'order'				=&gt; 'ASC'
	);

	$r = new WP_Query($queryArgs);
	if ($r-&gt;have_posts()) :
?&gt;
	&lt;?php echo $before_widget; ?&gt;
	&lt;?php echo $before_title . $title . $after_title; ?&gt;
	&lt;ul&gt;
	&lt;?php  while ($r-&gt;have_posts()) : $r-&gt;the_post(); ?&gt;
	&lt;li&gt;&lt;?php if ( get_the_title() ) the_title(); else the_ID(); ?&gt;&lt;?php edit_post_link('e',' (',')'); ?&gt;&lt;/li&gt;
	&lt;?php endwhile; ?&gt;
	&lt;/ul&gt;
	&lt;?php echo $after_widget; ?&gt;
&lt;?php
	endif;
	wp_reset_query();  // Restore global post data stomped by the_post().
}
</pre><p>The first thing we do is extract $args, which gives you $name, $id, $before_widget, $after_widget, $before_title, $after_title, $widget_id, and $widget_name.  We&#8217;ll use those throughout the rest of the function.  Next we set $title.  If it was specified in the settings for the widget, then use use it and apply the widget_title filter to it.  If a title wasn&#8217;t specified, we use &#8220;Upcoming Posts&#8221;.</p><p>Next, we deal with the number of posts to display.  If nothing was specified in the widget settings, we set $number to 10.  If the user did specify the number of posts to display, we do some sanity checks to make sure that the number is at least 0 and no more than 15.  This isn&#8217;t absolutely necessary, but it&#8217;s nice to set some limits to things don&#8217;t get out of hand.</p><p>Now we need to prepare to actually query the database and retrieve the posts.  In order to get the posts we want, we set the following:</p><dl><dt>showposts</dt><dd>This sets the number of posts to display.</dd><dt>what_to_show</dt><dd>This specifies what items to retrieve from the database.  We want posts, not pages, attachments, revisions, etc.</dd><dt>nopaging</dt><dd>If the blog is set up to show fewer posts per page than we&#8217;re trying to get, paging would interfere.  We turn it off just to be safe.</dd><dt>post_status</dt><dd>Since this plugin displays scheduled posts, we need to make sure that the post status is future, not published, draft, etc.</dd><dt>caller_get_posts</dt><dd>This is to make sure that sticky posts aren&#8217;t re-ordered to the top.</dd><dt>order</dt><dd>The order defaults to descending, which means it displays post with the highest (most futuristic) date first.  We want to display the next post (oldest scheduled post) first, so we set this to ASC for ascending.</dd></dl><p>Now that all the options are set, we run the query.  We want to make sure that all output is inside the have_posts loop, so that if no posts are returned the widget doesn&#8217;t display (rather than showing the title with no posts).  In order to fit within all themes, you want to make sure to always echo your output in this order: $before_widget, $before_title, $title, $after_title, your widget content, $after_widget.  A theme can customize each of those before and after items to create the proper markup for their design, so it&#8217;s important to use them.  Our widget content is simply an unordered list of posts.  The only little extra I added is the edit_post_link(), which will display a link to edit the post if you are logged in with sufficient permissions.  The last thing we do is reset the query, so that our widget query doesn&#8217;t mess up other queries.</p><p>The next method we need to set up is the update method.  Technically this isn&#8217;t actually required, but it gives us a chance to sanitize input.</p><pre class="brush: php;">
function update( $new_instance, $old_instance ) {
	$instance = $old_instance;
	$instance['title'] = strip_tags($new_instance['title']);
	$instance['number'] = (int) $new_instance['number'];

	return $instance;
}
</pre><p>As you can see, we strip tags from the title and make sure that number is and integer.  You&#8217;ll notice that we take the old instance and update it with info from the new instance.  This makes sure that no one tries to sneak in extra data by modifying the form on the widget admin page.  It&#8217;s not necessary, but it&#8217;s a little more secure.</p><p>The last thing we need to do is set up the form method, which actually displays the settings on the widget admin page.</p><pre class="brush: php;">
function form( $instance ) {
	$title = attribute_escape($instance['title']);
	if ( !$number = (int) $instance['number'] )
		$number = 5;
?&gt;
	&lt;p&gt;&lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id('title'); ?&gt;&quot;&gt;
	&lt;?php _e('Title:'); ?&gt;
	&lt;input class=&quot;widefat&quot; id=&quot;&lt;?php echo $this-&gt;get_field_id('title'); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name('title'); ?&gt;&quot; type=&quot;text&quot; value=&quot;&lt;?php echo $title; ?&gt;&quot; /&gt;&lt;/label&gt;&lt;/p&gt;

	&lt;p&gt;&lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id('number'); ?&gt;&quot;&gt;
	&lt;?php _e('Number of posts to show:'); ?&gt;
	&lt;input id=&quot;&lt;?php echo $this-&gt;get_field_id('number'); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name('number'); ?&gt;&quot; type=&quot;text&quot; value=&quot;&lt;?php echo $number; ?&gt;&quot; /&gt;&lt;/label&gt;
	&lt;br /&gt;&lt;small&gt;&lt;?php _e('(at most 15)'); ?&gt;&lt;/small&gt;&lt;/p&gt;
&lt;?php
}
</pre><p>Since we will be putting the title into the value attribute of an input element, we want to make sure it&#8217;s safe to do so by using attribute_escape() first.  Then we make sure that number is an integer and set it to 5 if it does not exist (this doesn&#8217;t actually set the widget settings to 5, it just displays a 5 in the form field rather than leaving it blank, giving the user and idea of what&#8217;s expected).  Then we break out of PHP and actually display the form.  The format I use is the default and will make your widget blend with the ones included with WordPress.  It goes like this (with and without &#8220;hint text&#8221;):</p><pre class="brush: xml;">
&lt;p&gt;
	&lt;label&gt;
		Label Text
		&lt;input&gt;
	&lt;/label&gt;
&lt;/p&gt;

&lt;p&gt;
	&lt;label&gt;
		Label Text
		&lt;input&gt;
	&lt;/label&gt;
	&lt;br /&gt;
	&lt;small&gt;
		Hint Text
	&lt;/small&gt;
&lt;/p&gt;
</pre><p>That&#8217;s it!  Your widget is done, it matches the existing widgets, and can be dropped into any widget-ready section of a WordPress 2.8+ blog!  Download a slightly more advanced version of the <a
href="http://xavisys.com/2009/04/wordpress-upcoming-posts-widget/">Upcoming Posts Widget</a> that includes caching, and try it out!  you can also see the widget completed below:</p><pre class="brush: php;">
/**
 * Upcoming_Posts widget class
 */
class WP_Widget_Upcoming_Posts extends WP_Widget {
	function WP_Widget_Upcoming_Posts() {
		$widget_ops = array('classname' =&gt; 'widget_upcoming_entries', 'description' =&gt; __( &quot;List scheduled/upcoming posts&quot;, 'upcoming_posts_widget') );
		$this-&gt;WP_Widget('upcoming-posts', __('Upcoming Posts', 'upcoming_posts_widget'), $widget_ops);
	}

	function widget($args, $instance) {
		extract($args);

		$title = empty($instance['title']) ? __('Upcoming Posts', 'upcoming_posts_widget') : apply_filters('widget_title', $instance['title']);
		if ( !$number = (int) $instance['number'] )
			$number = 10;
		else if ( $number &lt; 1 )
			$number = 1;
		else if ( $number &gt; 15 )
			$number = 15;

		$queryArgs = array(
			'showposts'			=&gt; $number,
			'what_to_show'		=&gt; 'posts',
			'nopaging'			=&gt; 0,
			'post_status'		=&gt; 'future',
			'caller_get_posts'	=&gt; 1,
			'order'				=&gt; 'ASC'
		);

		$r = new WP_Query($queryArgs);
		if ($r-&gt;have_posts()) :
	?&gt;
		&lt;?php echo $before_widget; ?&gt;
		&lt;?php echo $before_title . $title . $after_title; ?&gt;
		&lt;ul&gt;
		&lt;?php  while ($r-&gt;have_posts()) : $r-&gt;the_post(); ?&gt;
		&lt;li&gt;&lt;?php if ( get_the_title() ) the_title(); else the_ID(); ?&gt;&lt;?php edit_post_link('e',' (',')'); ?&gt;&lt;/li&gt;
		&lt;?php endwhile; ?&gt;
		&lt;/ul&gt;
		&lt;?php echo $after_widget; ?&gt;
	&lt;?php
		endif;
		wp_reset_query();  // Restore global post data stomped by the_post().
	}

	function update( $new_instance, $old_instance ) {
		$instance = $old_instance;
		$instance['title'] = strip_tags($new_instance['title']);
		$instance['number'] = (int) $new_instance['number'];

		return $instance;
	}

	function form( $instance ) {
		$title = attribute_escape($instance['title']);
		if ( !$number = (int) $instance['number'] )
			$number = 5;
	?&gt;
		&lt;p&gt;&lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id('title'); ?&gt;&quot;&gt;
		&lt;?php _e('Title:'); ?&gt;
		&lt;input class=&quot;widefat&quot; id=&quot;&lt;?php echo $this-&gt;get_field_id('title'); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name('title'); ?&gt;&quot; type=&quot;text&quot; value=&quot;&lt;?php echo $title; ?&gt;&quot; /&gt;&lt;/label&gt;&lt;/p&gt;

		&lt;p&gt;&lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id('number'); ?&gt;&quot;&gt;
		&lt;?php _e('Number of posts to show:'); ?&gt;
		&lt;input id=&quot;&lt;?php echo $this-&gt;get_field_id('number'); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name('number'); ?&gt;&quot; type=&quot;text&quot; value=&quot;&lt;?php echo $number; ?&gt;&quot; /&gt;&lt;/label&gt;
		&lt;br /&gt;&lt;small&gt;&lt;?php _e('(at most 15)'); ?&gt;&lt;/small&gt;&lt;/p&gt;
	&lt;?php
	}
}
function registerUpcomingPostsWidget() {
	register_widget('WP_Widget_Upcoming_Posts');
}
add_action('widgets_init', 'registerUpcomingPostsWidget');
</pre><h3 class='related_post_title'>Related Posts:</h3><ul
class='related_post'><li><a
href='http://xavisys.com/wordpress-core-canonical-plugins/' title='WordPress Core vs Canonical Plugins'>WordPress Core vs Canonical Plugins</a></li><li><a
href='http://xavisys.com/wordpress-haspatch-marathon/' title='The WordPress has-patch marathon'>The WordPress has-patch marathon</a></li><li><a
href='http://xavisys.com/xavisys-wordpress-plugin-framework/' title='The Xavisys WordPress Plugin Framework'>The Xavisys WordPress Plugin Framework</a></li><li><a
href='http://xavisys.com/wordpress-developer-meeting-july-01-2009/' title='WordPress Developer Meeting &#8211; July 01, 2009'>WordPress Developer Meeting &#8211; July 01, 2009</a></li><li><a
href='http://xavisys.com/wordpress-2-8-release-date/' title='WordPress 2.8 Release Date'>WordPress 2.8 Release Date</a></li></ul> <img src="http://feeds.feedburner.com/~r/Xavisys/~4/NcDe5vJZnK4" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://xavisys.com/wordpress-widget/feed/</wfw:commentRss> <slash:comments>8</slash:comments> <feedburner:origLink>http://xavisys.com/wordpress-widget/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=wordpress-widget</feedburner:origLink></item> <item><title>Howto: Create and Stream a CSV with PHP</title><link>http://feedproxy.google.com/~r/Xavisys/~3/xP4v-j4CLPw/</link> <comments>http://xavisys.com/howto-create-stream-csv-php/#comments</comments> <pubDate>Tue, 27 Oct 2009 06:10:22 +0000</pubDate> <dc:creator>AaronCampbell</dc:creator> <category><![CDATA[PHP]]></category> <category><![CDATA[File Download]]></category> <category><![CDATA[Stream Files]]></category><guid isPermaLink="false">http://xavisys.com/?p=500</guid> <description><![CDATA[I find myself constantly creating csv files for users to download.  Whether it&#8217;s a method for users to export their data to excel, a way for users to backup their hosted data, or just a simple way to send them report information, csv files are extremely useful.   Normally I just create an [...]]]></description> <content:encoded><![CDATA[<p>I find myself constantly creating <abbr
title="Comma Separated Values">csv</abbr> files for users to download.  Whether it&#8217;s a method for users to export their data to excel, a way for users to backup their hosted data, or just a simple way to send them report information, <abbr
title="Comma Separated Values">csv</abbr> files are extremely useful.   Normally I just create an actual file and link to it for the user to download.  The files are usually cleaned up after a certain amount of time or after a certain number of newer files exist.</p><p>Recently however, I had a client that really wanted to be able to export data in <abbr
title="Comma Separated Values">csv</abbr> format without ever creating a file on the webserver.  Their concern was rooted in security, but the reality of the matter was that they were trying to obey the letter of the law with regards to company policies.  Whether it was truly necessary or not is for another discussion.  Instead, the technique is actually very useful so I thought I&#8217;d share.</p><p>The key to this is that the <a
href="http://php.net/fopen">fopen</a> function supports <a
href="http://php.net/wrappers.php">php input/output streams</a> as <a
href="http://us2.php.net/wrappers">wrappers</a>.</p><p><span
id="more-500"></span></p><p>Start by sending the headers to allow the user to download the <abbr
title="Comma Separated Values">csv</abbr> file, then open a stream:</p><pre class="brush: php;">
$fileName = 'somefile.csv';

header(&amp;quot;Cache-Control: must-revalidate, post-check=0, pre-check=0&amp;quot;);
header('Content-Description: File Transfer');
header(&amp;quot;Content-type: text/csv&amp;quot;);
header(&amp;quot;Content-Disposition: attachment; filename={$fileName}&amp;quot;);
header(&amp;quot;Expires: 0&amp;quot;);
header(&amp;quot;Pragma: public&amp;quot;);

$fh = @fopen( 'php://output', 'w' );
</pre><p>At this point, anything you send to the newly opened stream ends up in the downloaded <abbr
title="Comma Separated Values">csv</abbr> file.  I did this in WordPress, but you can pull your data from anywhere, just pass an array to <a
href="http://php.net/fputcsv">fputcsv()</a>.  In this case, $data is an associative array with the field name as the key and the field value as the value.</p><pre class="brush: php;">
global $wpdb;
$query = &amp;quot;SELECT * FROM `{$wpdb-&amp;gt;prefix}my_table`&amp;quot;;
$results = $wpdb-&amp;gt;get_results( $query, ARRAY_A );

$headerDisplayed = false;

foreach ( $results as $data ) {
	// Add a header row if it hasn't been added yet
	if ( !$headerDisplayed ) {
		// Use the keys from $data as the titles
		fputcsv($fh, array_keys($data));
		$headerDisplayed = true;
	}

	// Put the data into the stream
	fputcsv($fh, $data);
}
// Close the file
fclose($fh);
// Make sure nothing else is sent, our file is done
exit;
</pre><p>As you can see, the actual code is quite simple.  Here it is all put together:</p><pre class="brush: php;">
$fileName = 'somefile.csv';

header(&amp;quot;Cache-Control: must-revalidate, post-check=0, pre-check=0&amp;quot;);
header('Content-Description: File Transfer');
header(&amp;quot;Content-type: text/csv&amp;quot;);
header(&amp;quot;Content-Disposition: attachment; filename={$fileName}&amp;quot;);
header(&amp;quot;Expires: 0&amp;quot;);
header(&amp;quot;Pragma: public&amp;quot;);

$fh = @fopen( 'php://output', 'w' );

global $wpdb;
$query = &amp;quot;SELECT * FROM `{$wpdb-&amp;gt;prefix}my_table`&amp;quot;;
$results = $wpdb-&amp;gt;get_results( $query, ARRAY_A );

$headerDisplayed = false;

foreach ( $results as $data ) {
	// Add a header row if it hasn't been added yet
	if ( !$headerDisplayed ) {
		// Use the keys from $data as the titles
		fputcsv($fh, array_keys($data));
		$headerDisplayed = true;
	}

	// Put the data into the stream
	fputcsv($fh, $data);
}
// Close the file
fclose($fh);
// Make sure nothing else is sent, our file is done
exit;
</pre><p>I hope you find it useful!<br
/><h3 class='related_post_title'>Related Posts:</h3><ul
class='related_post'><li><a
href='http://xavisys.com/wordpress-25-shortcodes/' title='WordPress 2.5 Shortcodes'>WordPress 2.5 Shortcodes</a></li><li><a
href='http://xavisys.com/wordpress-should-update-get_sidebar-to-work-with-multiple-sidebars/' title='Wordpress Should Update get_sidebar to Work With Multiple Sidebars'>Wordpress Should Update get_sidebar to Work With Multiple Sidebars</a></li><li><a
href='http://xavisys.com/php-function-to-redirect-a-user-with-a-message/' title='PHP function to Redirect a user with a message'>PHP function to Redirect a user with a message</a></li><li><a
href='http://xavisys.com/replace-every-other-occurrence-with-str_replace/' title='Replace every other occurrence with str_replace'>Replace every other occurrence with str_replace</a></li><li><a
href='http://xavisys.com/php-pagination-with-mysqli/' title='PHP Pagination with mysqli'>PHP Pagination with mysqli</a></li></ul> <img src="http://feeds.feedburner.com/~r/Xavisys/~4/xP4v-j4CLPw" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://xavisys.com/howto-create-stream-csv-php/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <feedburner:origLink>http://xavisys.com/howto-create-stream-csv-php/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=howto-create-stream-csv-php</feedburner:origLink></item> </channel> </rss><!-- This site's performance optimized by W3 Total Cache. Dramatically improve the speed and reliability of your blog!

Learn more about our WordPress Plugins: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk
Database Caching using apc
Content Delivery Network via cdn.xavisys.com

Served from: 173.203.136.116 @ 2010-02-24 09:44:13 -->
