<?xml version="1.0" encoding="utf-8"?>
<!-- generator="wordpress/2.0.2" -->
<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/"
	>

<channel>
	<title>stewart ugelow</title>
	<link>http://www.ugelow.com/tags/wordpress/feed</link>
	<description>www.ugelow.com</description>
	<pubDate>Wed, 19 Apr 2006 23:38:25 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.2</generator>
	<language>en</language>
			<item>
		<title>Simpler WordPress Search URLs</title>
		<link>http://www.ugelow.com/2006/04/19/simpler-wordpress-search-urls/</link>
		<pubDate>Wed, 19 Apr 2006 23:38:25 +0000</pubDate>
		
	<dc:subject>Dev</dc:subject>
	<dc:subject>WordPress</dc:subject><dc:subject>Cruft</dc:subject><dc:subject>Cruft Free</dc:subject><dc:subject>Permalinks</dc:subject><dc:subject>Wordpress</dc:subject>
		<guid isPermaLink="false">http://www.ugelow.com/2006/04/19/simpler-wordpress-search-urls/</guid>
		<description><![CDATA[WordPress-powered URLs ending in <span class="code">/search/foo</span> (where "foo" is your search term) now work the same way as the old-school format of <span class="code">index.php?s=foo</span>. They're cleaner, more intuitive, and darned easier on the eyes.

The only problem? The search form included in most templates produces old-school URLs instead of the newer ones. Thankfully, there's a simple, elegant workaround using the WordPress WP_Query class.]]></description>
			<content:encoded><![CDATA[<p>Thanks to some under-the-hood black magic, newer versions of WordPress support a streamlined permalink structure for search URLs. (In some corners, these are known as <a href="http://en.wikipedia.org/wiki/Cruft" target="_blank">&#8220;cruft-free&#8221; URLs.</a>) </p>
<p>WordPress-powered URLs ending in <span class="code">/search/foo</span> (where &#8220;<a href="http://en.wikipedia.org/wiki/Metasyntactic_variable#Foo.2C_Bar.2C_and_Baz" target="_blank">foo</a>&#8221; is your search term) now work the same way as the old-school format of <span class="code">index.php?s=foo</span>. They&#8217;re cleaner, more intuitive, and darned easier on the eyes.</p>
<p>The only problem? The search form included in most templates produces old-school URLs instead of the newer ones, and the various ways of recoding the search form (see last year&#8217;s <a href="http://comox.textdrive.com/pipermail/wp-hackers/2005-April/000719.html" target="_blank">discussion</a> on the wp-hackers mailing list) seem more trouble than they&#8217;re worth.</p>
<p>Thankfully, there&#8217;s a simple, elegant workaround using the WordPress <a href="http://codex.wordpress.org/Function_Reference/WP_Query" target="_blank">WP_Query</a> class. Just add the code below to the <em>very top</em> of your <code>header.php</code> template and say goodbye to ugly search URLs.</p>
<pre><code>&lt;?php
if ((is_search()) &amp;&amp; ($_GET['s'])) {
	wp_redirect(get_bloginfo('url')."/search/".get_query_var('s'));
} //if
?&gt;</code></pre>
<p>As usual, standard disclaimers apply.
</p>
]]></content:encoded>
			</item>
		<item>
		<title>Introducing Theme Widgets</title>
		<link>http://www.ugelow.com/2006/04/17/introducing-theme-widgets/</link>
		<pubDate>Mon, 17 Apr 2006 23:11:51 +0000</pubDate>
		
	<dc:subject>Dev</dc:subject>
	<dc:subject>WordPress</dc:subject><dc:subject>Wordpress</dc:subject><dc:subject>Wordpress Plugins</dc:subject><dc:subject>Wordpress Widgets</dc:subject>
		<guid isPermaLink="false">http://www.ugelow.com/2006/04/17/introducing-theme-widgets/</guid>
		<description><![CDATA[<p>So you've just completed your upgrade to WordPress 2.x. You've installed the latest and greatest versions of your favorite plugins. You've lovingly tweaked your favorite theme to within an inch of its life. All is well with the world.</p>
<p>Then along come WordPress Widgets.</p>]]></description>
			<content:encoded><![CDATA[<p>So you&#8217;ve just completed your upgrade to WordPress 2.x. You&#8217;ve installed the latest and greatest versions of your favorite plugins. You&#8217;ve lovingly tweaked your favorite theme to within an inch of its life. All is well with the world.</p>
<p>Then the WordPress development team comes along and introduces the brand new <a href="http://wordpress.org/development/2006/03/widgets-plugin/" target="_blank">WordPress Widgets</a>: slick chunks o&#8217; code that make it easy to modify your WordPress-powered site&#8217;s sidebar from a simple drag-and-drop menu. Overnight there&#8217;s a new <a href="http://widgets.wordpress.com/" target="_blank">widget blog</a>, a flurry of rejiggered themes, and the utterly grotesque new jargon &#8220;to widgetize.&#8221;</p>
<p>The good news? Customizing a third-party WordPress theme is much, much easier for end-users.</p>
<p>The bad news? While coding up a widget isn&#8217;t rocket science, it&#8217;s beyond the PHP skill level of most theme designers. (Those who <a href="http://lorelle.wordpress.com/2006/04/07/wordpress-themes-do-you-want-someone-messing-around-with-your-theme/" target="_blank">want end-users customizing their themes</a>, that is.)</p>
<p>As a result, there&#8217;s an awful lot of perfectly good code suddenly consigned to the dustbin. On the flip side, there&#8217;s been a ton of energy devoted to creating widgets that are essentially wrappers for existing plugins.</p>
<p>Wouldn&#8217;t it be better if making widgets were as simple as making theme template files? Well, now it can be that simple thanks to modifications I made to a <a href="http://guff.szub.net/2006/04/06/my-widget-example-wordpress-widget/" target="_blank">sample widget</a> by plugin writer Kaf Oseo.</p>
<p>Here&#8217;s how it works:</p>
<ol>
<li>
<p><a href="http://automattic.com/code/widgets/use/" target="_blank">Download and install</a> the WordPress Widgets plugin.</p>
</li>
<li>
<p><a href="http://www.ugelow.com/code/" target="_blank">Download and install</a> my Theme Widgets plugin.</p>
</li>
<li>
<p>If you are not using the WordPress default theme (Kubrick) or a theme that has already been updated to be widget-friendly, follow the <a href="http://automattic.com/code/widgets/themes/" target="_blank">instructions</a> for enabling the dynamic sidebar.</p>
</li>
<li>
<p>For each widget you want to offer, create a file with the appropriate code in your theme folder using a name that begins with <code>widget-</code> or <code>widget_</code>.</p>
<p>For example, try creating a file named <code>widget-example.php</code> in your theme file with the following contents:</p>
<pre>
<code>&lt;?php
/*
Widget Name: Theme Widgets Example
*/

print("&lt;p&gt;This is an example of the Theme Widgets plugin.&lt;/p&gt;");	
?&gt;
</code>
</pre>
</li>
<li>
<p>Go to the &#8220;Sidebar Widgets&#8221; item in the presentation menu. At the bottom of the page you should have a new dialog box that lets you set the number of theme widgets:</p>
<p><img src="/assets/images/themewidgets/screenshot3.gif" alt="How many theme widgets would you like?" width="499" height="136" border="1"></p>
</li>
<li>
<p>Then find &quot;Theme Widget 1&quot; in the &#8220;Available Widgets&#8221; box above and click on the widget options icon (where the blue arrow is pointing below).</p>
<p><img src="/assets/images/themewidgets/screenshot1.gif" alt="Click on the theme widget control" width="240" height="30" border="1"></p>
</li>
<li>
<p>You should see a dialog box like this one:</p>
<p><img src="/assets/images/themewidgets/screenshot2.gif" alt="Select a widget from the WordPress Default Theme folder" width="600" height="381" border="1"></p>
</li>
<li>
<p>Just click on the radio button for the theme widget you want &mdash; in this case you&#8217;ll obviously just have the one <code>widget-example.php</code> to choose from &mdash; and fill in the optional title and text fields if you&#8217;d like.</p>
</li>
<li>The close the widget and be sure to click on the &#8220;Save changes&#8221; button, <em>which may not be visible on your screen unless you scroll down.</em>
<p><img src="/assets/images/themewidgets/screenshot4.gif" alt="Save changes" width="126" height="33" border="1"></p>
</li>
<li>
<p>If all goes well, the next time you visit your site you should see &#8220;This is an example of the Theme Widgets plugin.&#8221; in your new sidebar. You&#8217;re now in business!</p>
</li>
</ol>
<p>So there it is: ten simple steps to theme widget happiness. It&#8217;s so easy, it&#8217;s Automaggic!</p>
]]></content:encoded>
			</item>
		<item>
		<title>Stewart&#8217;s Theme Widgets</title>
		<link>http://www.ugelow.com/2006/04/17/stewart-theme-widgets/</link>
		<pubDate>Mon, 17 Apr 2006 23:04:51 +0000</pubDate>
		
	<dc:subject>WordPress Plugins</dc:subject><dc:subject>Wordpress</dc:subject><dc:subject>Wordpress Plugins</dc:subject><dc:subject>Wordpress Widgets</dc:subject>
		<guid isPermaLink="false">http://www.ugelow.com/2006/04/17/stewart-theme-widgets/</guid>
		<description><![CDATA[<p>Creates widgets from files whose names begin with <code>widget-</code> or <code>widget_</code> in your theme folder. Based on <a href="http://guff.szub.net/" target="_blank">Kaf Oseo's</a> My Widget.</p>]]></description>
			<content:encoded><![CDATA[<p>Creates widgets from files whose names begin with <code>widget-</code> or <code>widget_</code> in your theme folder. Based on <a href="http://guff.szub.net/" target="_blank">Kaf Oseo&#8217;s</a> My Widget.</p>
<p><a href="/downloads/code/stewart_themewidgets.zip" target="_blank">download</a> | <a href="/downloads/code/stewart_themewidgets.phps"  target="_blank">view source</a></p>
]]></content:encoded>
			</item>
	</channel>
</rss>
