<?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>Alex Mansfield &#187; Plugins</title>
	<atom:link href="http://alexmansfield.com/tag/plugins/feed" rel="self" type="application/rss+xml" />
	<link>http://alexmansfield.com</link>
	<description>WordPress Developer</description>
	<lastBuildDate>Tue, 28 Feb 2012 23:24:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>WordPress Plugin: Latest Posts by Author</title>
		<link>http://alexmansfield.com/plugins/latest-posts-by-author</link>
		<comments>http://alexmansfield.com/plugins/latest-posts-by-author#comments</comments>
		<pubDate>Tue, 11 Aug 2009 23:52:59 +0000</pubDate>
		<dc:creator>alexmansfield</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://alexmansfield.com/?p=377</guid>
		<description><![CDATA[Update: The plugin has gone through a number of revisions since I first published this post. See: http://wordpress.org/extend/plugins/latest-posts-by-author/ for the latest versions. The code posted below is from version 0.6. I just posted my first plugin to wordpress.org. It creates an unordered list of the most recent posts by a given author. It can be [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update</strong>: The plugin has gone through a number of revisions since I first published this post. See: <a href="http://wordpress.org/extend/plugins/latest-posts-by-author/">http://wordpress.org/extend/plugins/latest-posts-by-author/</a> for the latest versions. The code posted below is from version 0.6.</p>
<p>I just posted my first plugin to <a href="http://wordpress.org/">wordpress.org</a>. It creates an unordered list of the most recent posts by a given author. It can be called both from within a post using a shortcode or from within a theme file. Check out <a href="http://wordpress.org/extend/plugins/latest-posts-by-author/">Latest Posts by Author</a> at wordpress.org for more details.</p>
<p>To demonstrate just how easy it is to create a plugin for WordPress, I&#8217;m posting the plugin code below.</p>
<pre class="brush: php; title: ; notranslate">&lt;?php

/*
Plugin Name: Latest Posts by Author
Plugin URI: http://wordpress.org/#
Description: Displays a list of recent posts by the specified author
Author: Alex Mansfield
Version: 0.6
Author URI: http://alexmansfield.com/
*/

function latest_posts_by_author($array) {
 extract(shortcode_atts(array('author' =&gt; 'admin', 'show' =&gt; 5, 'excerpt' =&gt; 'false'), $array));

 global $wpdb;
 $table = $wpdb-&gt;prefix . 'users';
 $result = $wpdb-&gt;get_results('SELECT ID FROM '.$table.' WHERE user_login = &quot;'.$author.'&quot;');
 $id = $result[0]-&gt;ID;
 $table = $wpdb-&gt;prefix . 'posts';
 $result = $wpdb-&gt;get_results('SELECT * FROM '.$table.' WHERE post_author = '.$id.' AND post_status = &quot;publish&quot; AND post_type = &quot;post&quot; ORDER BY post_date DESC');
 $i = 0;
 $html = '&lt;ul&gt;';
 foreach ($result as $numpost) {
 $html .= '&lt;li&gt;&lt;a href=&quot;'.get_permalink($numpost-&gt;ID).'&quot;&gt;'.$numpost-&gt;post_title.'&lt;/a&gt;';
 if($excerpt == 'true'){
 $html .= '&lt;p&gt;'.$numpost-&gt;post_excerpt.'&lt;/p&gt;';
 }
 $html .= '&lt;/li&gt;';
 $i++;
 if($i == $show){
 break;
 }
 }
 $html .= '&lt;/ul&gt;';

 return $html;
}

add_shortcode('latestbyauthor', 'latest_posts_by_author');

?&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://alexmansfield.com/plugins/latest-posts-by-author/feed</wfw:commentRss>
		<slash:comments>46</slash:comments>
		</item>
	</channel>
</rss>

