<?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>Xavisys&#187; wordpress development</title>
	<atom:link href="http://xavisys.com/category/wordpress-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://xavisys.com</link>
	<description>WordPress Plugins and Custom WordPress Development</description>
	<lastBuildDate>Wed, 16 Nov 2011 20:45:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<atom:link rel='hub' href='http://xavisys.com/?pushpress=hub'/>
		<item>
		<title>WordPress Q &amp; A</title>
		<link>http://xavisys.com/wordpress-q-a/</link>
		<comments>http://xavisys.com/wordpress-q-a/#comments</comments>
		<pubDate>Sat, 22 Jan 2011 00:52:29 +0000</pubDate>
		<dc:creator>Aaron D. Campbell</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[wordpress development]]></category>
		<category><![CDATA[WordPress News]]></category>
		<category><![CDATA[WordPress Howto]]></category>

		<guid isPermaLink="false">http://xavisys.com/?p=887</guid>
		<description><![CDATA[I realize that I&#8217;ve done a horrible job of posting here over the last year. I made exactly two posts in 2010. However, just because I haven&#8217;t been posting here doesn&#8217;t mean I&#8217;ve disappeared. I&#8217;ve still been working on WordPress, WordPress powered sites, WordPress plugins, and even some side projects built on WordPress (Like Beer?). [...]]]></description>
			<content:encoded><![CDATA[<p>I realize that I&#8217;ve done a horrible job of posting here over the last year.  I made <a href="http://xavisys.com/2010/">exactly two posts in 2010</a>.  However, just because I haven&#8217;t been posting here doesn&#8217;t mean I&#8217;ve disappeared.  I&#8217;ve still been working on WordPress, WordPress powered sites, WordPress plugins, and even some side projects built on WordPress (<a href="http://shouldipourit.com/">Like Beer?</a>).  My biggest problem is deciding what to write about, so I&#8217;ve come up with a solution.  I&#8217;m going to answer your questions.  Not only will this help me come up with ideas of what I should write about, it will also make sure that my content is specifically useful to you.</p>
<p>So, if you want to know how to best use WordPress&#8217;s built in http class to integrate with an existing API, how to add your own taxonomies to your site, how to make your theme more extensible, or almost anything else WordPress related, please just ask!</p>
<p>
                <div class='gf_browser_unknown gform_wrapper' id='gform_wrapper_3' ><form method='post' enctype='multipart/form-data'  id='gform_3'  action='/category/wordpress-development/feed/'>
                        <div class='gform_heading'>
                            <h3 class='gform_title'>WordPress Question</h3>
                            <span class='gform_description'>Ask me your WordPress question!</span>
                        </div>
                        <div class='gform_body'>
                            <ul id='gform_fields_3' class='gform_fields top_label description_below'><li id='field_3_1' class='gfield               gfield_contains_required' ><label class='gfield_label' for='input_3_1_3'>Your Name<span class='gfield_required'>*</span></label><div class='ginput_complex ginput_container' id='input_3_1'><span id='input_3_1_3_container' class='ginput_left'><input type='text' name='input_1.3' id='input_3_1_3' value='' tabindex='1' /><label for='input_3_1_3'>First</label></span><span id='input_3_1_6_container' class='ginput_right'><input type='text' name='input_1.6' id='input_3_1_6' value='' tabindex='2' /><label for='input_3_1_6'>Last</label></span></div></li><li id='field_3_2' class='gfield               gfield_contains_required' ><label class='gfield_label' for='input_3_2'>E-Mail Address<span class='gfield_required'>*</span></label><div class='ginput_container'><input name='input_2' id='input_3_2' type='text' value='' class='medium'  tabindex='3'  /></div></li><li id='field_3_3' class='gfield               gfield_contains_required' ><label class='gfield_label' for='input_3_3'>Your WordPress Question<span class='gfield_required'>*</span></label><div class='ginput_container'><input name='input_3' id='input_3_3' type='text' value='' class='medium'  tabindex='4'  /></div></li><li id='field_3_4' class='gfield' ><label class='gfield_label' for='input_3_4'>More Information</label><div class='ginput_container'><textarea name='input_4' id='input_3_4' class='textarea medium' tabindex='5'  rows='10' cols='50'></textarea></div></li><li id='field_3_5' class='gfield    gform_validation_container' ><label class='gfield_label' for='input_3_5'>Comments</label><div class='ginput_container'><input name='input_5' id='input_3_5' type='text' value='' /></div><div class='gfield_description'>This field is for validation purposes and should be left unchanged.</div></li>
                            </ul></div>
        <div class='gform_footer top_label'> <input type='submit' id='gform_submit_button_3' class='button gform_button' value='Ask' tabindex='6' />
            <input type='hidden' class='gform_hidden' name='is_submit_3' value='1' />
            <input type='hidden' class='gform_hidden' name='gform_submit' value='3' />
            <input type='hidden' class='gform_hidden' name='gform_unique_id' value='4f3341da0ea93' />
            <input type='hidden' class='gform_hidden' name='state_3' value='YToyOntpOjA7czo2OiJhOjA6e30iO2k6MTtzOjMyOiI4YWUwYTQ4MWRjY2UwNTA3Y2VkZGNjYTY3NWIyMTEyYiI7fQ==' />
            <input type='hidden' class='gform_hidden' name='gform_target_page_number_3' id='gform_target_page_number_3' value='0' />
            <input type='hidden' class='gform_hidden' name='gform_source_page_number_3' id='gform_source_page_number_3' value='1' />
            <input type='hidden' name='gform_field_values' value='' />
            
        </div>
                </form>
                </div><br />
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<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/speaking-at-wordcamp-san-francisco-2011/' title='Speaking at WordCamp San Francisco 2011'>Speaking at WordCamp San Francisco 2011</a></li>
<li><a href='http://xavisys.com/google-summer-of-code-2010/' title='Google Summer of Code 2010'>Google Summer of Code 2010</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/wordcamp-san-francisco-2009/' title='WordCamp San Francisco 2009'>WordCamp San Francisco 2009</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://xavisys.com/wordpress-q-a/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordCamp SF 2010</title>
		<link>http://xavisys.com/wordcamp-sf-2010/</link>
		<comments>http://xavisys.com/wordcamp-sf-2010/#comments</comments>
		<pubDate>Thu, 27 May 2010 18:51:38 +0000</pubDate>
		<dc:creator>Aaron D. Campbell</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[wordpress development]]></category>
		<category><![CDATA[WordPress News]]></category>
		<category><![CDATA[WordCamp]]></category>
		<category><![CDATA[WordCamp SF 2010]]></category>

		<guid isPermaLink="false">http://xavisys.com/?p=870</guid>
		<description><![CDATA[I know this post is quite delayed, but I wanted to get it out there anyway. Last year I went to WordCamp SF and attended several of the sessions. This year I went to WordCamp SF 2010, but things were a little different. I ended up spending most of my time at the Genius Bar [...]]]></description>
			<content:encoded><![CDATA[<p>I know this post is quite delayed, but I wanted to get it out there anyway.  Last year I went to <a href="http://xavisys.com/tag/wordcamp-sf-2009/">WordCamp SF</a> and attended several of the sessions.  This year I went to <a href="http://2010.sf.wordcamp.org/">WordCamp SF 2010</a>, but things were a little different.  I ended up spending most of my time at the Genius Bar helping the attendees with WordPress.  The Genius Bar was organized by <a href="http://foolswisdom.com/">Lloyd Budd</a>, and while I only volunteered for a single session there, I found it hard to pull myself away from helping the various interesting people that showed up.  The questions ranged from how to scale up because of a large influx of traffic, to &#8220;How do I get downstairs?&#8221; (hint: we <strong>were</strong> downstairs).</p>
<p>Following the WordCamp event, my wife and I went to one of the <a href="http://www.aiwf.org/norcal/chapter_news/article.html?news_id=1465">best food and wine events we&#8217;ve ever attended</a>.  It was at a place called One Market, and was put on by The American Institute of Wine &#038; Food.  We had lamb starting with the tongue and cheek, working our way back to the leg.  Each course was paired with one or two wines from the <a href="http://www.zacherlewines.com/">Zacherle</a> or <a href="http://www.fishervineyards.com/">Fisher</a> labels, and the wine makers were there to talk about each wine and answer our many questions (who knows what a &#8220;brick&#8221; is in wine making, and why some wines need fewer bricks than others?).  It was a beautiful, fancy, entertaining dinner.</p>
<p>When we finished that, we caught a cab over to the Automattic Lounge at Pier 38 to catch part of the WordCamp after party.  Talk about a shock to the system.  We left a place where lamb was being served to people in suits and fancy dresses who were seated at tables with linens and full silverware sets, and within minutes we were at a party with blaring music and full of geeks, many of who had consumed considerably more alcohol than recommended.  We spent a little time saying hi to everyone, having a few laughs at the expense of the imbibed (you know who you are), and I got my picture taken with several people (I&#8217;m not sure any of them knew who I was, they just seemed to like posing with someone and getting their picture taken).  We left relatively early, around midnight, and headed back to the hotel.  I knew from the year before that the developer day was going to be my personal favorite part of the event, and I didn&#8217;t want to be falling asleep at the laptop all day.</p>
<p>The following morning I arrived back at the Pier 38 lounge to find that I was the first to arrive for the developer day (I was a few minutes early).  <a href="http://ryan.boren.me/">Ryan Boren</a> was the next to show, but we ended up having to wait a little longer until someone with keys arrived.  I&#8217;m not sure people really got the &#8220;unconference&#8221; thing, as everyone kept wanting to know what was scheduled for when, and where things would be happening.  The basic idea is simply &#8220;find people that want to discuss what you want to discuss, form a group, and discuss it.&#8221;  Eventually a group of us formed at one of the tables and began working on WordPress 3.0.  I&#8217;m sure I can&#8217;t name everyone, but I know <a href="http://dd32.id.au/">Dion Hulse</a>, <a href="http://ryan.boren.me/">Ryan Boren</a>, <a href="http://www.andrewnacin.com/">Andrew Nacin</a>, <a href="http://sivel.net/">Matt Martz</a>, <a href="http://developersmind.com/">Pete Mall</a>, <a href="http://johnjamesjacoby.com/">John Jacoby</a>, and <a href="http://ptahdunbar.com/">Ptah Dunbar</a> were all there.  Dion and I spent several hours on an elusive bug with a <a href="http://core.trac.wordpress.org/changeset/14341">rather simple fix</a>, and it was really great to finally get to put faces with the names and handles that I see regularly on IRC, mailing lists, Trac, etc.</p>
<p>After the dev day coding, several of us walked down to Gordon Biersch, had dinner together and tried not to talk about WordPress too much (although Andrew Nacin&#8217;s like a machine&#8230;you just can&#8217;t stop the man!).  So, what do you think we would do after a long day of coding?  Well, we&#8217;re geeks, so we walked to one of the hotels were a few of the guys were staying, went up to their lounge, and started doing some more coding.  As a guy who works from home and tends to work only with remote programmers, it was really nice to spend some time with people that understood what I was saying!  I&#8217;m looking forward to seeing everyone again next year.<br />
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<li><a href='http://xavisys.com/speaking-at-wordcamp-san-francisco-2011/' title='Speaking at WordCamp San Francisco 2011'>Speaking at WordCamp San Francisco 2011</a></li>
<li><a href='http://xavisys.com/wordcamp-phoenix-2011-a-developers-take/' title='WordCamp Phoenix 2011 &#8211; A Developers Take'>WordCamp Phoenix 2011 &#8211; A Developers Take</a></li>
<li><a href='http://xavisys.com/google-summer-of-code-2010/' title='Google Summer of Code 2010'>Google Summer of Code 2010</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-widget/' title='How To Make Your Own WordPress Widget'>How To Make Your Own WordPress Widget</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://xavisys.com/wordcamp-sf-2010/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Google Summer of Code 2010</title>
		<link>http://xavisys.com/google-summer-of-code-2010/</link>
		<comments>http://xavisys.com/google-summer-of-code-2010/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 17:09:27 +0000</pubDate>
		<dc:creator>Aaron D. Campbell</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[wordpress development]]></category>
		<category><![CDATA[WordPress News]]></category>
		<category><![CDATA[GSoC]]></category>

		<guid isPermaLink="false">http://xavisys.com/?p=864</guid>
		<description><![CDATA[It&#8217;s official (and has been for a few days, I&#8217;m a little behind schedule), the 15 students selected to work on WordPress this summer as part of the Google Summer of Code have been announced. The lineup is pretty great. There are some names on the list that will be familiar to those who are [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s official (and has been for a few days, I&#8217;m a little behind schedule), the <a href="http://wpdevel.wordpress.com/2010/04/26/gsoc-students-announced/">15 students selected to work on WordPress</a> this summer as part of the Google Summer of Code have been announced.  The lineup is pretty great.  There are some names on the list that will be familiar to those who are already involved in the WordPress development community.  Andrew Nacin for example was given <a href="http://wpdevel.wordpress.com/2010/02/11/another-community-member-has-impressed-u/">WordPress core commit access</a> in February.  Also,<br />
Justin Shreve and Daryl Koopersmith both participated in last year&#8217;s GSoC (quite successfully).</p>
<p>This year there are a lot of great students and projects.  I&#8217;m definitely excited to see what happens with all of them.  However, I&#8217;m most excited about the student that I&#8217;m going to be mentoring.  Jon Stacey is going to be <a href="http://jonsview.com/projects/wordpress-project-proposal-file-api-stream-wrapper-support">implementing stream wrappers into the WordPress file API</a>.  He did a similar project for Drupal as part of GSoC last year, and this year we were able to woo him over to WordPress.</p>
<p>Not only does the project have great potential, but since stream wrappers were introduced in PHP 5, it will help push WordPress toward PHP 5 as a minimum requirement (which I&#8217;m all for).  So good luck to Jon and <a href="http://socghop.appspot.com/gsoc/program/list_projects/google/gsoc2010">all the 2010 GSoC students</a>.<br />
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<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/wordpress-haspatch-marathon/' title='The WordPress has-patch marathon'>The WordPress has-patch marathon</a></li>
<li><a href='http://xavisys.com/speaking-at-wordcamp-san-francisco-2011/' title='Speaking at WordCamp San Francisco 2011'>Speaking at WordCamp San Francisco 2011</a></li>
<li><a href='http://xavisys.com/wordpress-q-a/' title='WordPress Q &amp; A'>WordPress Q &#038; A</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://xavisys.com/google-summer-of-code-2010/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>How To Make Your Own WordPress Widget</title>
		<link>http://xavisys.com/wordpress-widget/</link>
		<comments>http://xavisys.com/wordpress-widget/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 18:45:26 +0000</pubDate>
		<dc:creator>Aaron D. Campbell</dc:creator>
				<category><![CDATA[wordpress development]]></category>
		<category><![CDATA[WordPress Widgets]]></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 it will [...]]]></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; title: ; notranslate">
/**
 * 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; title: ; notranslate">
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; title: ; notranslate">
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; title: ; notranslate">
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; title: ; notranslate">
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; title: ; notranslate">
&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; title: ; notranslate">
/**
 * 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-q-a/' title='WordPress Q &amp; A'>WordPress Q &#038; A</a></li>
<li><a href='http://xavisys.com/google-summer-of-code-2010/' title='Google Summer of Code 2010'>Google Summer of Code 2010</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/wordpress-haspatch-marathon/' title='The WordPress has-patch marathon'>The WordPress has-patch marathon</a></li>
<li><a href='http://xavisys.com/speaking-at-wordcamp-san-francisco-2011/' title='Speaking at WordCamp San Francisco 2011'>Speaking at WordCamp San Francisco 2011</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://xavisys.com/wordpress-widget/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>News About WordPress 2.9</title>
		<link>http://xavisys.com/news-wordpress-29/</link>
		<comments>http://xavisys.com/news-wordpress-29/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 15:16:28 +0000</pubDate>
		<dc:creator>Aaron D. Campbell</dc:creator>
				<category><![CDATA[wordpress development]]></category>
		<category><![CDATA[Upcoming WordPress Release]]></category>
		<category><![CDATA[WordPress 2.9]]></category>
		<category><![CDATA[WordPress News]]></category>
		<category><![CDATA[WordPress Performance]]></category>

		<guid isPermaLink="false">http://wpinformer.com/?p=81</guid>
		<description><![CDATA[There was a meeting in IRC for WordPress developers yesterday. A release date for WordPress 2.8 was chosen, and they made some great decisions regarding WordPress 2.9 as well. Here&#8217;s a quick summary of the things I found important. For WordPress 2.9, they&#8217;ve decided to raise the version of MySQL supported from 4.0 to 4.1.2! [...]]]></description>
			<content:encoded><![CDATA[<p>There was a <a href="http://wordpress.org/development/2009/06/summary-of-wordpress-dev-irc-meetup-for-20090603/">meeting in IRC for WordPress developers</a> yesterday.  A <a href="http://wpinformer.com/wordpress-2-8-release-date/">release date for WordPress 2.8</a> was chosen, and they made some great decisions regarding WordPress 2.9 as well.  Here&#8217;s a quick summary of the things I found important.</p>
<p>For WordPress 2.9, they&#8217;ve decided to raise the version of MySQL supported from 4.0 to 4.1.2!  That may not seem like much to those of us out there using the latest versions of everything, since version 5.1 is out, 5.4 is in beta, and even 6.0 is under development (and because 4.1.2 was released in May of 2004).  However, the big thing that sticks out to me is that 4.1 support subqueries and unicode.  Unicode should help for people that are using WordPress in non-English languages, and subqueries should help to greatly simplify queries.  Also in 4.1 MySQL added support for the &#8216;INSERT &#8230; ON DUPLICATE KEY UPDATE&#8217; syntax which will insert a new row unless that would cause a duplicate primary or unique key, in which case it updates the existing row.</p>
<p><span id="more-81"></span></p>
<p>I&#8217;m looking forward to the next few versions of WordPress, which I predict will get considerably faster (and the codebase will probably lean out a little too) simply because of the additional MySQL functionality.  Just remember that there&#8217;s a lot to do and not every query will be updated in 2.9 to take advantage of the new versions.  Also, for those that are worried, they plan to add a check to the automatic upgrader to keep people from upgrading to 2.9 if they don&#8217;t have a new enough version of MySQL.</p>
<p>Which brings me to the next big decision.  While WordPress is <strong>not</strong> going to require PHP 5, they <strong>are</strong> going to suggest it.  If someone is still running PHP 4, the WordPress upgrader will suggest that they switch to PHP 5, and will even link to a Codex page describing how to do it for various hosts!  As someone who&#8217;s been a huge proponent of moving the PHP requirements up to PHP 5, this is a big step in the right direction.  According to Matt Mullenweg at WordCamp San Francisco 2009, over 80% of WordPress.org users are already on PHP 5+.  If a notice like this could raise that percentage enough to make it reasonable to require PHP 5+, the codebase will see some huge improvements.</p>
<p>Overall, the meeting (which I unfortunately missed) took some great steps toward serious improvements of WordPress both in 2.9 and the versions to follow.<br />
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<li><a href='http://xavisys.com/wordpress-29/' title='Looking forward to WordPress 2.9'>Looking forward to WordPress 2.9</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>
<li><a href='http://xavisys.com/wordpress-weekly-podcast/' title='WordPress Weekly Podcast'>WordPress Weekly Podcast</a></li>
<li><a href='http://xavisys.com/improve-performance-of-your-wordpress-theme-in-5-minutes/' title='Improve Performance of Your WordPress Theme in 5 Minutes'>Improve Performance of Your WordPress Theme in 5 Minutes</a></li>
<li><a href='http://xavisys.com/drag-drop-widgets-wordpress-2-8/' title='WordPress 2.8 Brings Back Drag and Drop Widget Management'>WordPress 2.8 Brings Back Drag and Drop Widget Management</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://xavisys.com/news-wordpress-29/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>WordPress 2.8 Release Date</title>
		<link>http://xavisys.com/wordpress-2-8-release-date/</link>
		<comments>http://xavisys.com/wordpress-2-8-release-date/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 14:23:20 +0000</pubDate>
		<dc:creator>Aaron D. Campbell</dc:creator>
				<category><![CDATA[wordpress development]]></category>
		<category><![CDATA[Upcoming WordPress Release]]></category>
		<category><![CDATA[WordPress 2.8]]></category>

		<guid isPermaLink="false">http://wpinformer.com/?p=79</guid>
		<description><![CDATA[I&#8217;ll keep this short. There was a meeting in IRC for WordPress developers yesterday. The quick summary is that you can expect the release of 2.8 on June 10th, 2009. However, while that&#8217;s what so many people are asking, that wasn&#8217;t the exciting part! Stay tuned for news about WordPress 2.9. Related Posts: WordPress 2.8 [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ll keep this short.  There was a <a href="http://wordpress.org/development/2009/06/summary-of-wordpress-dev-irc-meetup-for-20090603/">meeting in IRC for WordPress developers</a> yesterday.  The quick summary is that you can expect the release of 2.8 on June 10th, 2009.  However, while that&#8217;s what so many people are asking, that wasn&#8217;t the exciting part!  Stay tuned for news about WordPress 2.9.<br />
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<li><a href='http://xavisys.com/drag-drop-widgets-wordpress-2-8/' title='WordPress 2.8 Brings Back Drag and Drop Widget Management'>WordPress 2.8 Brings Back Drag and Drop Widget Management</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-29/' title='Looking forward to WordPress 2.9'>Looking forward to WordPress 2.9</a></li>
<li><a href='http://xavisys.com/news-wordpress-29/' title='News About WordPress 2.9'>News About WordPress 2.9</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://xavisys.com/wordpress-2-8-release-date/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WordPress and the Google Summer of Code</title>
		<link>http://xavisys.com/wordpress-google-summer-code/</link>
		<comments>http://xavisys.com/wordpress-google-summer-code/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 13:00:41 +0000</pubDate>
		<dc:creator>Aaron D. Campbell</dc:creator>
				<category><![CDATA[wordpress development]]></category>
		<category><![CDATA[Google Summer of Code]]></category>

		<guid isPermaLink="false">http://wpinformer.com/?p=36</guid>
		<description><![CDATA[For those that don&#8217;t know, Google has been doing something called the Summer of Code since 2005. Google picks open source projects to fund development for. Then they accept applications from college students and then choose about 1000 winners in conjunction with the project mentors. Project mentors are experienced developers that are familiar with the [...]]]></description>
			<content:encoded><![CDATA[<p>For those that don&#8217;t know, Google has been doing something called the <a href="http://code.google.com/soc/">Summer of Code</a> since 2005.  Google picks open source projects to fund development for.  Then they accept applications from college students and then choose about 1000 winners in conjunction with the project mentors.  Project mentors are experienced developers that are familiar with the project in question.  Each student is paired with a mentor, who will help by giving direction and advise throughout the process.  Google pays the students $4,500 each to complete their project over the summer, as part of their contribution to the open source community.  The main requirements are that you have to be 18 years old or older and enrolled as a full or part time student as of April 20, 2009.</p>
<p>The process goes something like this.  On May 23rd the students begin coding, and receive their first payment of $500.  On July 13th they have &#8220;Mid Term Evaluations&#8221; where the mentor evaluates the student, and the student evaluates both the mentor and the project. At this point, if the student isn&#8217;t performing, they will be dismissed, but the vast majority of students will continue and receive their second payment of $2000.  On August 17th the students stop coding.  On August 26th there is a final evaluation which works just like the mid term evaluations worked.  The student now receives their final $2000.  On September 3rd, the code must be submitted to Google.</p>
<p><span id="more-722"></span></p>
<p>WordPress has participated for the last three years, and recently the <a href="http://wordpress.org/development/2009/04/summer-of-code-students-announced/">Summer of Code students were announced</a>, along with their projects and mentors:</p>
<blockquote><p>
<strong>Justin Shreve</strong>, Extended WordPress Search Engine. Justin will be mentored by Andy Skelton. One of the complaints I hear over and over again is about the search engine, so this could have great benefit to WordPress core.</p>
<p><strong>Rudolf Cheuk Sang Lai</strong>, Adding Photo Grouping by Album Functionality. This project will wind up being a piece of a larger media redux project for 2.9/3.0. Mark Jaquith is mentoring, and Noel Jackson will be a backup mentor.</p>
<p><strong>Daryl Koopersmith</strong>, WYSIWYG theme editor/generator. This will allow users to create and edit themes without touching any code. Beau Lebens is the mentor on this project.</p>
<p><strong>Michael Benedict Arul </strong>will be working on a similar project. Michael will be mentored by Andrew Ozz, since this project will be using jQuery. It’s our hope that having two students working on this idea separately will foster competition and allow us to compare approaches.</p>
<p><strong>Daniel Larkin</strong>, Modified Preorder Tree Traversal (MPTT). Lead Developer Ryan Boren will be his mentor. This is Daniel’s second GSoC working on WordPress.</p>
<p><strong>Diego Caro</strong>, a student from Chile, will also work on an MPTT project. Diego will be mentored by Thorsten Ott.</p>
<p><strong>César Rodas</strong>, social and text processing algorithms for BuddyPress and MU as related to recommendation engines. Alex Shiels and Andy Peatling will co-mentor this project.</p>
<p><strong>Anthony Cole</strong>, Event management with WordPress. Co-organizer of WordCamp Australia and New Zealand, Anthony will be working on a suite of plugins (or maybe just one or two out of a planned set, scope TBD) for event management/attendee networking that will be built on BuddyPress/MU/bbPress. We’ll use wordcamp.org as a test case, and release the final product to the community. Jake Spurlock will be mentoring, with Andy Peatling as backup.
</p></blockquote>
<p>That&#8217;s eight students, which means Google is investing $36,000 into WordPress this summer!  This year we should see some great benefits from this process, including improved search functionality, implementation of the modified preorder tree traversal algorithm (which should help simplify some of the queries WordPress makes), and even some improvements to <a href="http://buddypress.org/">BuddyPress</a>.<br />
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<li><a href='http://xavisys.com/google-summer-of-code-2010/' title='Google Summer of Code 2010'>Google Summer of Code 2010</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-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/wordpress-developer-meeting-july-01-2009/' title='WordPress Developer Meeting &#8211; July 01, 2009'>WordPress Developer Meeting &#8211; July 01, 2009</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://xavisys.com/wordpress-google-summer-code/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

