<?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>A Tasty Pixel » Blog &#187; Wordpress</title>
	<atom:link href="http://atastypixel.com/blog/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://atastypixel.com/blog</link>
	<description></description>
	<lastBuildDate>Wed, 01 Sep 2010 22:10:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Galleria for WordPress</title>
		<link>http://atastypixel.com/blog/wordpress/plugins/galleria-for-wordpress/</link>
		<comments>http://atastypixel.com/blog/wordpress/plugins/galleria-for-wordpress/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 16:09:47 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress Plugins]]></category>

		<guid isPermaLink="false">http://atastypixel.com/blog/galleria-for-wordpress/</guid>
		<description><![CDATA[This plugin is based upon the Galleria javascript gallery, and displays your Flickr photos in a slideshow-like gallery. It also displays your groups and photosets in a clickable list, to display photosets in the gallery. This is a plugin I wrote for my own use (see it in action here), but I have received several [...]]]></description>
			<content:encoded><![CDATA[<p>This plugin is based upon the <a href="http://galleria.aino.se/">Galleria javascript gallery</a>, and displays your Flickr photos in a slideshow-like gallery.</p>

<p>It also displays your groups and photosets in a clickable list, to display photosets in the gallery.</p>

<p>This is a plugin I wrote for my own use <a href="http://michael.tyson.id.au/photos">(see it in action here)</a>, but I have received several requests to make it available.</p>

<p><span id="more-1982"></span></p>

<h2>Download and installation</h2>

<p>Download Galleria for WordPress here: <a href="http://atastypixel.com/blog/wp-content/uploads/2010/08/galleria.zip" title="galleria.zip">galleria.zip</a></p>

<p>To install, unzip within your <code>wp-content/plugins</code> folder, then activate the plugin under Plugin settings in WordPress.</p>

<h2>Usage</h2>

<p>After installing the plugin, use the following shortcodes in pages and posts:</p>

<h3>galleria</h3>

<p>Displays the Galleria javascript gallery with your photostream, or, if the user accesses the 
URL with an anchor tag containing a photoset ID, the contents of that photoset.</p>

<p>Parameters:</p>

<table>
<tr><td><tt>api_key</tt></td><td>Your flickr API key (get one <a href="http://www.flickr.com/services/apps/create/noncommercial/">here</a>)</td></tr>
<tr><td><tt>account</tt></td><td>Your flickr username</td></tr>
</table>

<p>Sample:</p>

<p><code>[galleria api_key="YOUR-API-KEY" account="your-user-name"]</code></p>

<h3>galleria_photosets</h3>

<p>Displays a nested list of your groups and photosets, with links to click to open the photoset in the current page.
Should be used on the same page as the galleria shortcode, above.  This list is generated client-side using Javascript.
Note that this means the list will not be picked up by search engine crawlers.</p>

<p>Parameters</p>

<table>
<tr><td><tt>api_key</tt></td><td>Your flickr API key (get one <a href="http://www.flickr.com/services/apps/create/noncommercial/">here</a>)</td></tr>
<tr><td><tt>user_id</tt></td><td>Your flickr user ID</td></tr>
</table>

<p>Sample:</p>

<p><code>[galleria_photosets api_key="YOUR-API-KEY" user_id="1234567@N00"]</code></p>
 <img src="http://atastypixel.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=1982" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://atastypixel.com/blog/wordpress/plugins/galleria-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Keeping blog visitors by showing meaningful search results in WordPress</title>
		<link>http://atastypixel.com/blog/keeping-blog-visitors-by-showing-meaningful-search-results-in-wordpress/</link>
		<comments>http://atastypixel.com/blog/keeping-blog-visitors-by-showing-meaningful-search-results-in-wordpress/#comments</comments>
		<pubDate>Sat, 05 Jun 2010 14:43:45 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://atastypixel.com/blog/?p=1927</guid>
		<description><![CDATA[By default, Wordpress will show you full, confusing posts when searching.  Keep your visitors happy by providing contextual search results like a proper search engine.  This post explains how to do it, in just a few minutes.]]></description>
			<content:encoded><![CDATA[<p>I recently became disgruntled with the way my blogs displayed search results.  By default, WordPress blogs will show searched posts exactly as they might appear on an index or archives page: Typically as an extract, or perhaps even as the full entry.</p>

<p>This doesn&#8217;t help at all if you&#8217;re looking for something in particular &#8211; It&#8217;s a much better idea to show the post within the context of the search query, as real search engines do.</p>

<p>See it in practice <a href="http://atastypixel.com/blog/?s=talkie">here</a>.</p>

<p>This is a fairly easy thing to actually get working in WordPress.  It&#8217;ll take just a couple of minutes, and will make a big difference to blog visitors.  Here&#8217;s how I did it.</p>

<p><span id="more-1927"></span></p>

<h2>Creating a search result page</h2>

<p>If your theme doesn&#8217;t already have one, you&#8217;ll need to construct a template within your theme that WordPress will use for search results.  By default, WordPress will use your <code>index.php</code> template, so that&#8217;s usually a good place to start with, for normal themes.</p>

<p>Duplicate <code>index.php</code>, and call it <code>search.php</code>.</p>

<p>If you already have a <code>search.php</code>, you&#8217;re all set.</p>

<h3>A note about theme engines</h3>

<p>A special case here is for theme engines like Thematic (which I use for this blog).  For Thematic, it&#8217;s a matter of un-hooking the provided search &#8216;loop&#8217; from within your child theme, and replacing it with your own.</p>

<p>In my case, with a Thematic child theme, this takes place within <code>functions.php</code>.  First, one needs an &#8216;init&#8217; action, to remove the existing hooks.</p>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> mytheme_init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   remove_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'thematic_searchloop'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'thematic_search_loop'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">...</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'init'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'mytheme_init'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>


<p>Then, it needs a replacement function to perform the search result loop:</p>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">function mytheme_search_loop() {
  while ( have_posts() ) : the_post(); ?&gt;
&nbsp;
    &lt;div id=&quot;post-<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; class=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> thematic_post_class<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
      <span style="color: #000000; font-weight: bold;">&lt;?php</span> thematic_postheader<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
      &lt;div class=&quot;entry-content&quot;&gt;
        <span style="color: #000000; font-weight: bold;">&lt;?php</span> thematic_content<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* We will replace this next */</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
      &lt;/div&gt;
      <span style="color: #000000; font-weight: bold;">&lt;?php</span> thematic_postfooter<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
  &lt;/div&gt;&lt;!-- .post --&gt;
&nbsp;
  <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">...</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'thematic_searchloop'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'mytheme_search_loop'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>


<h2>Some smarts to show context</h2>

<p>What I did was replace the content of each post displayed with some code that constructs and displays some context around the search terms found in the post.</p>

<p>In your <code>search.php</code> (or your search loop function, if you&#8217;re using a theme engine), look for the line that inserts the post content.  Chances are, it&#8217;ll look something like <code>&lt;?php the_content('Keep reading'); ?&gt;</code>.  In the case of the Thematic child theme above, it&#8217;s <code>&lt;php thematic_content(); ?&gt;</code>.</p>

<p>Delete that line, and replace it with the following (here&#8217;s a <a href="http://atastypixel.com/blog/wp-content/uploads/2010/06/search_snippet.txt" title="search_snippet.txt">plain-text version</a>, if that&#8217;s easier):</p>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// Configuration</span>
<span style="color: #000088;">$max_length</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">400</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Max length in characters</span>
<span style="color: #000088;">$min_padding</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">30</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Min length in characters of the context to place around found search terms</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Load content as plain text</span>
<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>post_password_required<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span> ? <span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/<span style="color: #000099; font-weight: bold;">\r</span>?<span style="color: #000099; font-weight: bold;">\n</span>/&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'@&lt;\s*(p|br\s*/?)\s*&gt;@'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> apply_filters<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_content'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_content</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Search content for terms</span>
<span style="color: #000088;">$terms</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query_vars</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'search_terms'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">preg_match_all</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/'</span><span style="color: #339933;">.</span><span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'\/'</span><span style="color: #339933;">,</span> <span style="color: #990000;">join</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'|'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$terms</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/i'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$content</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #339933;">,</span> PREG_OFFSET_CAPTURE<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$padding</span> <span style="color: #339933;">=</span> <span style="color: #990000;">max</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$min_padding</span><span style="color: #339933;">,</span> <span style="color: #000088;">$max_length</span> <span style="color: #339933;">/</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #339933;">*</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Construct extract containing context for each term</span>
  <span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$last_offset</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$match</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #990000;">list</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #339933;">,</span> <span style="color: #000088;">$offset</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$match</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$start</span>  <span style="color: #339933;">=</span> <span style="color: #000088;">$offset</span><span style="color: #339933;">-</span><span style="color: #000088;">$padding</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$end</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$offset</span><span style="color: #339933;">+</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #000088;">$padding</span><span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">// Preserve whole words</span>
    <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$start</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">1</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/[A-Za-z0-9\'&quot;-]/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$content</span><span style="color: #009900;">&#123;</span><span style="color: #000088;">$start</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000088;">$start</span><span style="color: #339933;">--;</span>
    <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$end</span> <span style="color: #339933;">&lt;</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/[A-Za-z0-9\'&quot;-]/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$content</span><span style="color: #009900;">&#123;</span><span style="color: #000088;">$end</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000088;">$end</span><span style="color: #339933;">++;</span>
    <span style="color: #000088;">$start</span> <span style="color: #339933;">=</span> <span style="color: #990000;">max</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$start</span><span style="color: #339933;">,</span> <span style="color: #000088;">$last_offset</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$context</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #339933;">,</span> <span style="color: #000088;">$start</span><span style="color: #339933;">,</span> <span style="color: #000088;">$end</span><span style="color: #339933;">-</span><span style="color: #000088;">$start</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$start</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$last_offset</span> <span style="color: #009900;">&#41;</span> <span style="color: #000088;">$context</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'...'</span><span style="color: #339933;">.</span><span style="color: #000088;">$context</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$context</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$last_offset</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$end</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$last_offset</span> <span style="color: #339933;">!=</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span> <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'...'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$content</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$output</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$max_length</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$end</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$max_length</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$end</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">1</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/[A-Za-z0-9\'&quot;-]/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$output</span><span style="color: #009900;">&#123;</span><span style="color: #000088;">$end</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000088;">$end</span><span style="color: #339933;">--;</span>
  <span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$output</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$end</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'...'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Highlight matches</span>
<span style="color: #000088;">$context</span> <span style="color: #339933;">=</span> <span style="color: #990000;">nl2br</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/'</span><span style="color: #339933;">.</span><span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'\/'</span><span style="color: #339933;">,</span> <span style="color: #990000;">join</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'|'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$terms</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/i'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;strong&gt;$0&lt;/strong&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$output</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;p class=&quot;search_result_context&quot;&gt;
  <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$context</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/p&gt;
&lt;p&gt;
  &lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; rel=&quot;bookmark&quot;&gt;Read this entry&lt;/a&gt;
&lt;/p&gt;</pre></div></div>


<p>Save, and search for something on your blog &#8212; you should see contextual search results, now.</p>

<h2>One final tweak: Results per page</h2>

<p>WordPress has a setting for the number of posts to show per page.  You may want to use a different number of <em>search results</em> per page, given that each result is now shorter than a full post.</p>

<p>To override this &#8216;posts per page&#8217; setting, you&#8217;ll want to find the line just before the search loop.  It&#8217;ll probably look like <code>&lt;?php if (have_posts()) : ?&gt;</code>, or, if your theme doesn&#8217;t bother with that part, <code>&lt;?php while ( have_posts() ) : the_post(); ?&gt;</code>.</p>

<p>Before that line, insert the following:</p>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">;</span> <span style="color: #000088;">$v</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query_vars</span><span style="color: #339933;">;</span> <span style="color: #000088;">$v</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'posts_per_page'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">;</span> query_posts<span style="color: #009900;">&#40;</span><span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>


<p>This will take the current query (including the search phrase, page number, etc.), add a &#8216;posts per page&#8217; parameter, then pass it back to WordPress&#8217;s query engine.</p>
 <img src="http://atastypixel.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=1927" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://atastypixel.com/blog/keeping-blog-visitors-by-showing-meaningful-search-results-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flickrpress 1.0</title>
		<link>http://atastypixel.com/blog/flickrpress-1-0/</link>
		<comments>http://atastypixel.com/blog/flickrpress-1-0/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 16:07:28 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress Plugins]]></category>

		<guid isPermaLink="false">http://atastypixel.com/blog/2010/01/18/flickrbox-1-0/</guid>
		<description><![CDATA[I&#8217;ve just finished a new release of my Flickr plugin for WordPress, Flickrpress. The new version features AJAX-based navigation between pages of images, and improved support for insertion within pages and posts as a shortcode. Flickrpress 1.0 can be downloaded from the WordPress plugin repository See it an action over on my personal blog.]]></description>
			<content:encoded><![CDATA[<p><img src="http://atastypixel.com/blog/wp-content/michaelangelo-images/6ad5e09a84cd0639f4df3f8c0ab478c9.jpg" width="246" height="246" alt="Flickrpress sample" class="alignright polaroid rotation" />I&#8217;ve just finished a new release of my Flickr plugin for WordPress, <a href="http://atastypixel.com/blog/wordpress/plugins/flickrpress/">Flickrpress</a>.</p>

<p>The new version features AJAX-based navigation between pages of images, and improved support for insertion within pages and posts as a shortcode.</p>

<p>Flickrpress 1.0 can be downloaded from the <a href="http://wordpress.org/extend/plugins/flickrpress">WordPress plugin repository</a></p>

<p>See it an action over on my <a href="http://michael.tyson.id.au/photos">personal blog</a>.</p>
 <img src="http://atastypixel.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=1807" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://atastypixel.com/blog/flickrpress-1-0/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Upload Janitor WordPress Plugin</title>
		<link>http://atastypixel.com/blog/wordpress/plugins/upload-janitor/</link>
		<comments>http://atastypixel.com/blog/wordpress/plugins/upload-janitor/#comments</comments>
		<pubDate>Sat, 16 Jan 2010 22:29:04 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress Plugins]]></category>

		<guid isPermaLink="false">http://atastypixel.com/blog/2010/01/16/upload-janitor-wordpress-plugin/</guid>
		<description><![CDATA[Clean up unused images and other files from your uploads folder.]]></description>
			<content:encoded><![CDATA[<p>This plugin allows you to reclaim disk space and clean up your uploads folder by deleting old uploads you are no longer linking to.</p>

<p>It will identify unused files within your uploads folder, and give you the option of archiving then deleting some or all of these files.</p>

<p>Before any action is taken, Upload Janitor will automatically make a &#8216;tar&#8217; archive of all files to be erased, including their original paths, so you can restore if necessary.</p>

<p><span id="more-1793"></span></p>

<h2>Download</h2>

<p>Download Upload Janitor from the <a href="http://wordpress.org/extend/plugins/upload-janitor">WordPress plugins directory</a>.</p>

<p>If you like Upload Janitor, please consider buying one of my <a href="http://atastypixel.com/products">products</a>.</p>

<h2>Installation</h2>

<ol>
<li>Unzip the package, and upload <code>upload-janitor</code> to the <code>wp-content/plugins</code> directory</li>
<li>Activate the plugin through the &#8216;Plugins&#8217; menu in WordPress</li>
<li>Visit &#8216;Upload Janitor&#8217; within the &#8216;Tools&#8217; menu in WordPress to use</li>
</ol>

<h2>How does it work?</h2>

<p>This plugin inspects every file within the uploads folder.  For each file, it searches pages or posts that
reference the file.  That is, the plugin searches for the part of each file&#8217;s path that comes after the path 
to the uploads folder, such as <code>2010/01/my great but forgotten image.jpg</code>.</p>

<p>The path is searched as-is, as well as URL-encoded with &#8216;%20&#8242; for spaces, and the same with &#8216;+&#8217; for spaces -
<code>2010/01/my%20great%20but%20forgotten%20image.jpg</code> and <code>2010/01/my+great+but+forgotten+image.jpg</code>.  HTML entity-encoded
forms of all of these are also searched.</p>

<p>If no matches are found, then the file is considered unused.</p>

<p>Note that this plugin plays it safe, and does not distinguish between older post/page revisions and the current version 
of a post/page.  If a revision references a file, the file will be considered still in use.</p>

<h2>Restoring</h2>

<p>If something goes wrong, you can always restore.  If you have shell access to your site, this is easy.  Simply log in,
navigate to your <code>wp-content/plugins</code> directory, and locate the Upload Janitor archive &#8211; it will look like 
<code>upload_janitor_archive_YYYY-mm-dd.tar.gz</code>.  Then, type:</p>

<pre><code>  tar zxf &lt;archive name&gt; .
</code></pre>

<p>This will restore all files within the archive.</p>

<p>If you do not have shell access to your server, you will have to download the archive, extract it, then upload the
contents back to your server.  The archive will be accessible at <code>http://your-blog.com/wp-content/uploads/upload_janitor_archive_YYYY-mm-dd.tar.gz</code></p>

<h2>Changes</h2>

<h3>0.2</h3>

<ul>
<li>Tweak for compatibility with some apparently buggy PHP installations</li>
<li>Additional error reporting for &#8216;tar&#8217; archiver</li>
</ul>

<h3>0.1</h3>

<ul>
<li>Initial release</li>
</ul>
 <img src="http://atastypixel.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=1793" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://atastypixel.com/blog/wordpress/plugins/upload-janitor/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Hidden Tags WordPress Plugin</title>
		<link>http://atastypixel.com/blog/wordpress/plugins/hidden-tags/</link>
		<comments>http://atastypixel.com/blog/wordpress/plugins/hidden-tags/#comments</comments>
		<pubDate>Sat, 16 Jan 2010 20:23:45 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress Plugins]]></category>

		<guid isPermaLink="false">http://atastypixel.com/blog/2010/01/16/hidden-tags-wordpress-plugin/</guid>
		<description><![CDATA[Hide certain tags/categories from the public]]></description>
			<content:encoded><![CDATA[<p>This plugin allows you to specify a list of tags or categories to keep hidden: These will no longer appear anywhere on the site, such as in the tag cloud or on the list of post tags. This is useful when using tags to control behaviour of your blog with other software, or when you wish to maintain groupings of posts out of the public eye.</p>

<p><span id="more-1791"></span></p>

<h2>Download</h2>

<p>Download Hidden Tags from the <a href="http://wordpress.org/extend/plugins/hidden-tags">WordPress plugins directory</a>.</p>

<p>If you like Hidden Tags, please consider buying one of my <a href="http://atastypixel.com/products">products</a>.</p>

<h2>Installation</h2>

<ol>
<li>Unzip the package, and upload <code>hidden-tags</code> to the <code>/wp-content/plugins/</code> directory</li>
<li>Activate the plugin through the &#8216;Plugins&#8217; menu in WordPress</li>
<li>Visit &#8216;Hidden Tags&#8217; settings underneath WordPress settings to configure</li>
</ol>

<h2>Changes</h2>

<ul>
<li>0.1: Initial release</li>
</ul>
 <img src="http://atastypixel.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=1791" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://atastypixel.com/blog/wordpress/plugins/hidden-tags/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Twitter Image Host for WordPress</title>
		<link>http://atastypixel.com/blog/wordpress/plugins/twitter-image-host/</link>
		<comments>http://atastypixel.com/blog/wordpress/plugins/twitter-image-host/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 13:44:58 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress Plugins]]></category>

		<guid isPermaLink="false">http://atastypixel.com/blog/2010/01/09/twitter-image-host-for-wordpress/</guid>
		<description><![CDATA[Keep your traffic in the family! Host Twitter images on your own site, with support for comments and trackbacks, image resizing and thumbnailing with Lightbox. Twitter doesn’t yet come with its own inline image support, so we tend to be limited to using image hosting services, and linking to them with short URLs. So, services [...]]]></description>
			<content:encoded><![CDATA[<p>Keep your traffic in the family!  Host Twitter images on your own site, with support for comments and trackbacks, image
resizing and thumbnailing with Lightbox.</p>

<p>Twitter doesn’t yet come with its own inline image support, so we tend to be limited to using image hosting services, 
and linking to them with short URLs. So, services like Twitpic host the image, and we direct traffic to them in return.</p>

<p>Better to take advantage of that traffic, and host images on your own site.  This way, viewers come to your site, instead
of someone else&#8217;s!</p>

<p>Posted images are displayed in your normal WordPress template, with support for comments and trackbacks, without any 
setup required.  Most themes should work with this, but if not, or if a different layout is required, a custom theme template 
can also be provided (see &#8216;Creating a Template&#8217;).</p>

<p>Provides an HTML form for posting image content, as well as an API modelled on that of <a href="http://img.ly/pages/API">img.ly</a>,
compatible with Tweetie (for iPhone) and any other Twitter clients that speak this protocol and offer configuration of
custom image hosting services.</p>

<p>Uses Twitter&#8217;s authentication and a list of authorised accounts, so you can let others use your image host too.  You can even 
post status updates to Twitter while submitting images.</p>

<p>Provides a widget and shortcode to display uploaded images.  This supports filtering by Twitter account, styling with CSS,
and Lightbox/Thickbox.</p>

<p><span id="more-1776"></span></p>

<h2>Download</h2>

<p>Download the plugin at <a href="http://wordpress.org/extend/plugins/twitter-image-host/">WordPress&#8217;s plugin directory</a></p>

<p>If you like Twitter Image Host, please consider buying some <a href="http://atastypixel.com/products">awesome Mac/iPhone software</a>.  Then tell all your friends.</p>

<h2>Installation</h2>

<ol>
<li>Unzip the package, and upload <code>twitter-image-host</code> to the <code>/wp-content/plugins/</code> directory</li>
<li>Activate the plugin through the &#8216;Plugins&#8217; menu in WordPress</li>
<li>Visit the settings page and add your Twitter account to the list of authorised accounts</li>
<li>Start submitting images &#8211; See the &#8216;Posting Images&#8217; section for more</li>
</ol>

<h2>FAQ</h2>

<h3>I get &#8220;Couldn&#8217;t place uploaded file&#8221; messages</h3>

<p>You probably need to create the folder in which Twitter Image Host stores uploaded images &#8212; it will try to create the folder automatically, but it will fail if it doesn&#8217;t have permission.</p>

<p>Create a folder called <code>twitter-image-host-content</code> within the <code>wp-content</code> folder of your WordPress installation, and make sure it has write permission for the web server user.</p>

<h3>I keep getting 404 errors</h3>

<p>Make sure your blog is using URL rewriting (i.e. your permalink structure is anything but the boring default <code>?p=###</code>).</p>

<h2>Widget</h2>

<p>To use the widget, simply visit the Widgets page and drag the &#8220;Twitter Images&#8221; widget into a sidebar and configure it.</p>

<h2>Shortcode</h2>

<p>Shortcodes are snippets of text that can be inserted into pages and posts.  These snippets are replaced by various generated content.
Twitter Image Host provides a &#8216;twitter-images&#8217; shortcode to display images you have uploaded within a page/post.</p>

<p>Available parameters:</p>

<table>
<tr><td><tt> count                   </tt></td><td> Number of items to display                                                                          </td></tr>
<tr><td><tt> id                      </tt></td><td> Single ID (eg &#8216;abcde&#8217;) of one image to display, or multiple IDs separated by commas (abcde,fghij)   </td></tr>
<tr><td><tt> view                    </tt></td><td> Image thumbnail view: squares, proportional, large or custom                                        </td></tr>
<tr><td><tt> custom_thumbnail_width  </tt></td><td> Custom width for thumbnails, when &#8216;view&#8217; is &#8216;custom&#8217;                                                </td></tr>
<tr><td><tt> custom_thumbnail_height </tt></td><td> Custom width for thumbnails, when &#8216;view&#8217; is &#8216;custom&#8217;                                                </td></tr>
<tr><td><tt> custom_thumbnail_crop   </tt></td><td> Whether to crop custom thumbnails                                                                   </td></tr>
<tr><td><tt> author                  </tt></td><td> Comma-separated list of Twitter account names to limit results to                                   </td></tr>
<tr><td><tt> columns                 </tt></td><td> Number of columns of images to display                                                              </td></tr>
<tr><td><tt> lightbox                </tt></td><td> &#8216;true&#8217; to use Lightbox/Thickbox                                                                     </td></tr>
</table>

<p>Example (square brackets replaced by curly brackets):</p>

<pre><code>  {twitter-images columns=4 lightbox="true"}
</code></pre>

<h2>PHP function</h2>

<p>As well as the shortcode, you can also use call <code>twitter_image_host_images()</code> from within a template to
produce the same output.  Pass the same arguments as the shortcode as associative array values:</p>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;h3&gt;Recently submitted images&lt;/h3&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> twitter_image_host_images<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'author'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'ATastyPixel'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'columns'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">6</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'lightbox'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>


<p>Tip: Use this in the <code>twitter-image-host.php</code> template (see &#8216;Creating a Single Template&#8217;, below) to display
other posted images when viewing an image.  Use <code>the_twitter_image_author()</code> to filter the list, to show
only other submissions by the same Twitter account as the one of the currently displayed image.</p>

<h2>Template Tags</h2>

<p>This plugin provides several template tags, for use both in displaying single posts (see &#8216;Creating a Single Template&#8217;), and for custom pages which display
many posts in a loop (see &#8216;Using Template Tags in a Loop&#8217;).</p>

<p>The available template tags are:</p>

<h3>Single Entry Tags</h3>

<p><em><code>the_twitter_image_permalink</code></em></p>

<p>Returns the URL to the view page</p>

<p><em><code>the_twitter_image_url</code></em></p>

<p>Returns the full URL to the image, or the image thumbnail if the original image was large</p>

<p><em><code>the_twitter_full_image_url</code></em></p>

<p>Returns the URL to the full-sized image, if one exists, or false otherwise</p>

<p><em><code>the_twitter_image_title</code></em></p>

<p>The title of the image</p>

<p><em><code>the_twitter_image_date</code></em></p>

<p>The date (timestamp) of the image &#8211; use date() to configure the display</p>

<p><em><code>the_twitter_image_author</code></em></p>

<p>The associated Twitter account</p>

<p><em><code>the_twitter_image</code></em></p>

<p>Returns HTML to display the image and a link to the full-sized image if it exists, with Lightbox rel tags.</p>

<h3>Loop Tags</h3>

<p><em><code>query_twitter_images</code></em></p>

<p>Search for Twitter images</p>

<p>Available parameters (passed as associative array):</p>

<table>
<tr><td><tt>     count         </tt></td><td>           Number of items to display                                                                            </td></tr>
<tr><td><tt>     id            </tt></td><td>           Single ID (eg &#8216;abcde&#8217;) of one image to display, or multiple IDs separated by commas (abcde,fghij)     </td></tr>
<tr><td><tt>     author        </tt></td><td>           Comma-separated list of Twitter account names to limit results to                                     </td></tr>
</table>

<p><em><code>has_twitter_images</code></em></p>

<p>Use with loop: Determine if there are more images</p>

<p><em><code>next_twitter_image</code></em></p>

<p>Use with loop: Get the next image</p>

<h3>Creating a Single Template</h3>

<p>By default, this plugin will use the standard post template (&#8216;single.php&#8217;).  However, if you wish, you can create a 
custom template to display hosted images.  The template should be called &#8216;twitter-image-host.php&#8217;, located within your
current theme directory.</p>

<p>Creating a template to use this information is fairly straightforward if you have just a little knowledge of HTML or PHP:</p>

<ul>
<li>On your server (via an FTP program, etc.), navigate to your current theme.  This will live within <code>wp-content/themes</code>.</li>
<li>Copy an existing template &#8211; <code>single.php</code> is usually a good candidate &#8211; and call it <code>twitter-image-host.php</code>.</li>
<li>Open up <code>twitter_image_host.php</code>, and delete everything that looks post-related: This usually includes everything between
the <code>have_posts</code> call and the matching <code>endif</code>, and may include some other surrounding content like an &#8216;Edit this post&#8217; link.</li>
<li>Replace that which you have just deleted with something that uses the &#8216;single entry&#8217; template tags above, like the following:</li>
</ul>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> the_twitter_image<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;h1 class=&quot;center&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> the_twitter_image_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h1&gt;
&lt;p class=&quot;center&quot;&gt;
	From &lt;a href=&quot;http://twitter.com/<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> the_twitter_image_author<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> the_twitter_image_author<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;
	 on <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'F jS, Y'</span><span style="color: #339933;">,</span> the_twitter_image_date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/p&gt;</pre></div></div>


<ul>
<li>Save the file, add some content (see the &#8216;Posting Images&#8217; section), and see how it looks.</li>
</ul>

<h3>Using Template Tags in a Loop</h3>

<p>Just like the WordPress Loop template tags, the template tags provided by this plugin can be used to display multiple posted entries.
This can be used to create a custom page template that lists all submitted entries, with more flexibility than that offered by the shortcode.</p>

<p>Use begins with a call to <code>query_twitter_images()</code>, possibly with an argument to configure the search.  If the result is true, then the loop begins,
conditional upon <code>has_twitter_images()</code>, and starting with <code>next_twitter_image()</code> to load the next entry.  The single template tags can then be used
to customise the display of each entry.</p>

<p>Here is an example of use:</p>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> query_twitter_images<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
    <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span> has_twitter_images<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> next_twitter_image<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
        &lt;div class=&quot;item entry&quot;&gt;
          &lt;div class=&quot;itemhead&quot;&gt;
            &lt;h1&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> the_twitter_image_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; rel=&quot;bookmark&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> the_twitter_image_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;&lt;/h1&gt;
            &lt;div class=&quot;date&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'F jS, Y'</span><span style="color: #339933;">,</span> the_twitter_image_date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/div&gt;
          &lt;/div&gt;
&nbsp;
          <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> the_twitter_image<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
          &lt;p class=&quot;center&quot;&gt;From &lt;a href=&quot;http://twitter.com/<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> the_twitter_image_author<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> the_twitter_image_author<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;&lt;/p&gt;
          &lt;/div&gt;
    <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">else</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
    &lt;p&gt;There are no Twitter images.&lt;/p&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>


<h2>Posting Images</h2>

<p>To start posting straight away, a simple form is provided at http://your-blog-url/twitter-image-host.
Enter a title for your image, your Twitter account details, and select your image.  Hit Submit, and you will be given the URL for the image.</p>

<p>To access this facility from an application, use the access point http://your-blog-url/twitter-image-host.</p>

<p>The API is more-or-less the same as that of <a href="http://twitpic.com/api.do">TweetPic</a>, <a href="http://img.ly/pages/API">img.ly</a>, etc.</p>

<p>To post from Twitter (Tweetie 2) for iPhone, visit Twitter/Tweetie&#8217;s settings, and within <em>Services, Image Service</em>, select &#8216;Custom&#8217;, then enter <code>http://your-blog.com/twitter-image-host/upload</code>.  Note that version 3.0.1 of Twitter has a bug that prevents it sending the username and password.  For this version, you must use <code>http://your-blog.com/twitter-image-host/upload?username=YourTwitterName&amp;password=YourPassword</code>, at your discretion.  Version 0.5.7 of Twitter Image Host now supports this.</p>

<h3>Automate it</h3>

<p><img src="http://atastypixel.com/blog/wp-content/uploads/2010/01/wflow.png" width="128" height="128" alt="Automator Service" class="alignright" />For Mac users, an Automator service has been created to upload images by right-clicking on a file in Finder, then selecting a context menu item, if you are using Snow Leopard.  This may still work for Leopard users, via the &#8216;Services&#8217; menu.</p>

<p>Download it here: 
<a href="http://atastypixel.com/blog/wp-content/uploads/2010/01/Send-Image-to-Image-Hosting1.zip" title="Send Image to Image Hosting.zip">Send Image to Image Hosting Automator service</a></p>

<p>To use it:</p>

<ol>
<li>Unzip</li>
<li>Double-click on &#8216;Send Image to Image Hosting&#8217; to open it for editing</li>
<li><p>In the third panel down, change the &#8216;HOST&#8217; value to the URL to your blog:
<a href="http://atastypixel.com/blog/wp-content/uploads/2010/01/edit-service.jpg" rel="lightbox[1776]"><img src="http://atastypixel.com/blog/wp-content/uploads/2010/01/edit-service-tm.jpg" width="200" height="230" alt="Editing the Automator service" class="aligncenter" /></a></p></li>
<li><p>Save</p></li>
<li>In Finder, navigate to the &#8216;Library&#8217; directory under your home folder.  Create a folder called &#8216;Services&#8217;, if it doesn&#8217;t already exist, then drag &#8216;Send Image to Image Hosting&#8217; into &#8216;Services&#8217;</li>
<li>Right-click on an image file, and you should see:</li>
</ol>

<p><img src="http://atastypixel.com/blog/wp-content/uploads/2010/01/Screen-shot-2010-01-09-at-13.59.13.png" width="321" height="131" alt="Screen shot 2010-01-09 at 13.59.13.png" class="aligncenter" /></p>

<p>If not, you may need to log out and log back in first.</p>

<h2>Making the URL even shorter</h2>

<p>If you run WordPress from a sub-directory (for example, http://your-site.com/blog), then the short URLs generated by this plugin will
look like http://your-site/blog/xxxxx.  You can remove that &#8216;blog&#8217; component via a little <code>.htaccess</code> trickery.</p>

<p>Here&#8217;s how:</p>

<ol>
<li>Create and open a new file in your site&#8217;s webroot called &#8220;.htaccess&#8221;. If there&#8217;s one already there, just open that up and prepare to edit at the bottom.</li>
<li><p>Add the following, replacing &#8216;blog&#8217; with the real subdirectory under which WordPress is installed:</p>

<pre><code>&lt;IfModule mod_rewrite.c&gt;
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/([^/]+)/?$
RewriteCond %{DOCUMENT_ROOT}/blog/wp-content/twitter-image-host-content/%1.jpg -f [OR]
RewriteCond %{DOCUMENT_ROOT}/blog/wp-content/twitter-image-host-content/%1.png -f [OR]
RewriteCond %{DOCUMENT_ROOT}/blog/wp-content/twitter-image-host-content/%1.jpeg -f
RewriteRule (.*) /blog/$1 [L]
&lt;/IfModule&gt;
</code></pre>

<p>This will take any requests that:</p>

<ul>
<li>Are located in the web-root (start with a slash, followed by anything but a slash until the end)</li>
<li>Have a corresponding file within Twitter Image Host&#8217;s content directory
Then, it&#8217;ll rewrite the request silently to the real Twitter Image Host URL, without the viewer seeing.</li>
</ul></li>
<li><p>In Twitter Image Host settings, set the &#8216;Override URL Prefix&#8217; option to &#8216;http://your-site.com/&#8217;</p></li>
</ol>
 <img src="http://atastypixel.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=1776" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://atastypixel.com/blog/wordpress/plugins/twitter-image-host/feed/</wfw:commentRss>
		<slash:comments>85</slash:comments>
		</item>
		<item>
		<title>Links for June 3rd through June 18th</title>
		<link>http://atastypixel.com/blog/links-june-3rd-june-18th/</link>
		<comments>http://atastypixel.com/blog/links-june-3rd-june-18th/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 00:00:26 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Links]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://atastypixel.com/blog/?p=1631</guid>
		<description><![CDATA[Links for June 3rd through June 18th: Ten logo design tips from the field &#124; Logo Design Love 10 astonishing CSS hacks and techniques Adaptive CSS-Layouts: New Era In Fluid Layouts? effective techniques to create 100%-functional adaptive CSS-layouts WordPress Theme Development Frameworks If you build and develop WordPress themes often, you will probably be fed [...]]]></description>
			<content:encoded><![CDATA[<p>Links for June 3rd through June 18th:</p>

<ul class="delicious-bookmarks">
<li><a href="http://www.logodesignlove.com/logo-design-tips">Ten logo design tips from the field | Logo Design Love</a> </li>
<li><a href="http://www.catswhocode.com/blog/10-astonishing-css-hacks-and-techniques">10 astonishing CSS hacks and techniques</a> </li>
<li><a href="http://www.smashingmagazine.com/2009/06/09/smart-fixes-for-fluid-layouts/">Adaptive CSS-Layouts: New Era In Fluid Layouts?</a> effective techniques to create 100%-functional adaptive CSS-layouts</li>
<li><a href="http://www.smashingmagazine.com/2009/05/27/wordpress-theme-development-frameworks/">WordPress Theme Development Frameworks</a> If you build and develop WordPress themes often, you will probably be fed up of all the repetitive code writing, the constantly checking of your mark-up and all you really want to do is focus on the design and the project-specific features. The answer is a WordPress development framework</li>
<li><a href="http://steveweller.com/articles/toolbar-icons/">How to Draw Pixel-Perfect iPhone Toolbar Icons</a> Using OmniGraffle</li>

</ul>
 <img src="http://atastypixel.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=1631" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://atastypixel.com/blog/links-june-3rd-june-18th/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Flickrpress: WordPress Flickr widget</title>
		<link>http://atastypixel.com/blog/wordpress/plugins/flickrpress/</link>
		<comments>http://atastypixel.com/blog/wordpress/plugins/flickrpress/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 05:32:26 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress Plugins]]></category>

		<guid isPermaLink="false">http://atastypixel.com/blog/2009/06/05/flickrbox-wordpress-flickr-widget/</guid>
		<description><![CDATA[Flickrpress is a widget to display items from Flickr in the sidebar.  Supports Flickr RSS, photostream, multiple photosets, favorites, filtering by tag and displaying random photos.]]></description>
			<content:encoded><![CDATA[<p><a href="http://atastypixel.com/blog/wp-content/uploads/2010/01/screenshot-1.png" rel="lightbox[1635]"><img src="http://atastypixel.com/blog/wp-content/uploads/2010/01/screenshot-1-tm.jpg" width="134" height="300" alt="Flickrpress screenshot" class="alignright" /></a>Flickrpress is a widget/shortcode function to display items from Flickr in the sidebar or within pages and posts.  This widget supports:</p>

<ul>
<li>Flickr RSS feeds</li>
<li>Photostream</li>
<li>Filtering by tag</li>
<li>One or more photosets</li>
<li>Favorites</li>
<li>Displaying random items</li>
</ul>

<p>Other features:</p>

<ul>
<li>Choose from three different thumbnail types</li>
<li>Lightbox/Thickbox are supported</li>
<li>Data is cached locally to lower server load</li>
<li>Secure Flickr API used, to eliminate the risk of damage to your server, unlike some other Flickr widgets</li>
<li>Flickrpress is a multi-widget, so you can use more than one instance (e.g., one in your sidebar, one in your footer)</li>
<li>Use as a shortcode to insert into posts and pages &#8212; multiple instances supported in the one entry</li>
</ul>

<p>Flickrpress uses the excellent phpFlickr library.</p>

<p><span id="more-1635"></span></p>

<h2>Download</h2>

<p>Download Flickrpress at the <a href="http://wordpress.org/extend/plugins/flickrpress">WordPress site</a>.</p>

<p>If you like Flickrpress, please consider buying one of my <a href="http://atastypixel.com/products">products</a>.</p>

<h2>Installation</h2>

<ol>
<li>Unzip the package, and upload <code>flickrpress</code> to the <code>/wp-content/plugins/</code> directory</li>
<li>Activate the plugin through the &#8216;Plugins&#8217; menu in WordPress</li>
<li>Add the &#8216;Flickr Widget&#8217; to your sidebar and configure, or see the &#8216;Shortcodes&#8217; section for information on use in pages and posts</li>
</ol>

<p>If you wish to use content from anything but an RSS feed, you will need a Flickr API key.  This can be obtained
from <a href="http://www.flickr.com/services/api/keys/apply">Flickr</a></p>

<p>If you wish to use Lightbox, you must first install the <a href="http://stimuli.ca/lightbox/">Lightbox plugin</a>.</p>

<h2>Shortcode</h2>

<p>Shortcodes are snippets of text that can be inserted into pages and posts.  These snippets are replaced by various generated content.
Flickrpress provides a &#8216;flickrpress&#8217; shortcode to display images from Flickr within a page/post.</p>

<p>Available parameters:</p>

<table>
 <tr><td><tt>type       </tt></td><td> One of: &#8216;rss&#8217;, &#8216;photostream&#8217;, &#8216;sets&#8217;, &#8216;favorites&#8217;</td></tr>
 <tr><td><tt>url        </tt></td><td> URL for RSS feed</td></tr>
 <tr><td><tt>api_key    </tt></td><td> API Key for types other than RSS</td></tr>
 <tr><td><tt>account    </tt></td><td> Account name, email or ID</td></tr>
 <tr><td><tt>sets       </tt></td><td> Comma-separated list of photoset titles</td></tr>
 <tr><td><tt>tags       </tt></td><td> Comma-separated list of tags to filter by (for photostream view)</td></tr>
 <tr><td><tt>view       </tt></td><td> One of: &#8216;squares&#8217; (view as squares), &#8216;proportional&#8217; (proportional thumbnails) , &#8216;large&#8217; (large thumbnails)</td></tr>
 <tr><td><tt>count      </tt></td><td> Number of thumbnails to display</td></tr>
 <tr><td><tt>paging     </tt></td><td> &#8216;true&#8217; to show page navigation, to move back and forward through pages of images (implemented using AJAX)</td></tr>
 <tr><td><tt>random     </tt></td><td> &#8216;true&#8217; to display randomly</td></tr>
 <tr><td><tt>lightbox   </tt></td><td> &#8216;true&#8217; to use Lightbox</td></tr>
 <tr><td><tt>columns    </tt></td><td> Number of columns of images to display</td></tr>
</table>

<p>Example:</p>

<pre><code>  [flickrpress type="photostream" api_key="xxxxxxxxxxxxxxxxxxxxxx" account="michaeltyson" count="30" paging="true" lightbox="true"]
</code></pre>

<h2>Styling</h2>

<p>Flickrpress comes with CSS styling, but if you wish to modify its appearance, such as adding frame borders, simply style the 
&#8220;<code>flickrpress-container</code>&#8221; class.  See <code>style.css</code> for more.</p>

<h2>FAQ</h2>

<h3>I&#8217;m seeing &#8220;Flickr is currently unavailable&#8221; messages</h3>

<blockquote>
  <p>You may have an incorrect setting: To see the actual error message, open your server&#8217;s error log and look for Flickrpress messages.  How you do that depends on your host – on mine, Site5, the error log appears in the WordPress folder; on others, you access it through a web interface). If you can’t get to it, open up the file <code>includes/interface.php</code> in the plugin’s folder, and change <code>error_log</code> on line 22 to <code>echo</code> – then any messages will be printed to the screen.  You&#8217;ll want to change it back afterwards so your visitors don&#8217;t see those messages.</p>
</blockquote>

<h2>Changelog</h2>

<h3>1.0.2</h3>

<ul>
<li>Added Thickbox support</li>
<li>Compatibility fix for PHP 4</li>
</ul>

<h3>1.0.1</h3>

<ul>
<li>Bugfix in navigation javascript encountered when Lightbox isn&#8217;t installed</li>
</ul>

<h3>1.0</h3>

<ul>
<li>Implemented AJAX-based navigation through pages of images</li>
<li>Added shortcode documentation</li>
<li>Caching for shortcode and php calls</li>
<li>Removed &#8216;css&#8217; option in favour of always including CSS</li>
<li>Fixed conflict between shortcode and widget versions</li>
<li>Fixed bug in loading all photostream items</li>
</ul>

<h3>0.3.2</h3>

<ul>
<li>Fixed a warning when using shortcode</li>
</ul>

<h3>0.3.1</h3>

<ul>
<li>Fixed a packaging snafu</li>
</ul>

<h3>0.3</h3>

<ul>
<li>Support for use outside of sidebar</li>
</ul>

<h3>0.2.1</h3>

<ul>
<li>Bugfix for displaying random favourites</li>
</ul>

<h3>0.2</h3>

<ul>
<li>Now able to be styled as described in http://www.webdesignerwall.com/tutorials/css-decorative-gallery/. See style.css for more info.</li>
</ul>

<h3>0.1.1</h3>

<ul>
<li>Bugfix for when only 1 random image shown</li>
</ul>

<h3>0.1</h3>

<ul>
<li>Initial release</li>
</ul>
 <img src="http://atastypixel.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=1635" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://atastypixel.com/blog/wordpress/plugins/flickrpress/feed/</wfw:commentRss>
		<slash:comments>194</slash:comments>
		</item>
		<item>
		<title>Firming up WordPress&#8217;s security</title>
		<link>http://atastypixel.com/blog/firming-up-wordpresss-security/</link>
		<comments>http://atastypixel.com/blog/firming-up-wordpresss-security/#comments</comments>
		<pubDate>Sun, 10 May 2009 02:22:17 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://atastypixel.com/blog/2009/05/10/firming-up-wordpresss-security/</guid>
		<description><![CDATA[Instructions on how to protect your Wordpress administration area with a layer of HTTP authentication.]]></description>
			<content:encoded><![CDATA[<p>There&#8217;re thousands of articles out there describing how to secure WordPress better against attacks, but I still had a little difficulty with the nuts and bolts, so I thought I&#8217;d detail the process I underwent here.</p>

<p>I recently had a bit of a security breach &#8211; some lowlife broke into my account and injected some phishing stuff into my personal webmail software.  Consequently, I went on a bit of a security binge and deleted some apps I wasn&#8217;t using much, changed all of my passwords to ridiculously long strings, and set up layers of HTTP authentication on my WordPress login/admin pages, the latter of which is described here.</p>

<p>The general idea is to make it hard to get to the login/admin pages in the first place, which should block some attacks.</p>

<p>The <a href="http://wordpress.org/extend/plugins/askapache-password-protect/">AskApache password protect</a> WordPress plugin will do all of this for you, <em>unless</em> it thinks your webserver doesn&#8217;t have the supporting software.  It failed for me on Site5, saying I lacked HTTP digest authentication support, which is actually not true, as it&#8217;s enabled.  I couldn&#8217;t be bothered debugging it though, so I proceeded with the manual route.</p>

<h1>Create the password file</h1>

<p>First, I created an <em>htpasswd</em> file, containing a login and password.  There&#8217;re many sites describing how to do this, but on the terminal, it&#8217;s fairly easy:</p>

<p><code>htpasswd -c /path/to/.htpasswd myusername</code></p>

<p>Note that it&#8217;s a good idea to put the .htpasswd file somewhere <em>outside</em> the web root &#8211; your account&#8217;s home directory is one option.</p>

<h1>Protect the login page</h1>

<p>I opened up the <code>.htaccess</code> in the WordPress root folder, and added the following:</p>


<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">ErrorDocument 401 default
&nbsp;
AuthUserFile /path/to/.htpasswd
AuthName &quot;Blog&quot;
AuthType Basic
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Files</span> <span style="color: #ff0000;">&quot;wp-login.php&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    require valid-user
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Files<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>


<p>Note that &#8216;ErrorDocument 401 default&#8217; line &#8211; this is in place to avoid getting a &#8217;404&#8242; error whenever you load up the login page.  I&#8217;m not entirely sure of the details, but it seems that if the rewrite module is used (the thing that allows WordPress to define an arbitrary website structure, without needing physical files), then this causes problems with HTTP authentication.</p>

<p>Also, if you wish to protect access to the XMLRPC access point as well, you can add the following:</p>


<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Files</span> <span style="color: #ff0000;">&quot;xmlrpc.php&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    require valid-user
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Files<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>


<p>However, if you do this, I&#8217;m pretty sure pingbacks (the WordPress-specific version of trackbacks) will no longer work.  I think trackbacks will still be functional &#8211; as far as I know, they use a different access point.  If you use a desktop blogging app, you&#8217;ll want to make sure it can handle HTTP authentication.  I know <a href="http://illuminex.com/ecto/">ecto</a> can.</p>

<h1>Protect the admin area</h1>

<p>Finally, I created a new <code>.htaccess</code> file in the <code>wp-admin</code> directory, which looks like this:</p>


<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">ErrorDocument 401 default
&nbsp;
AuthUserFile /path/to/.htpasswd
AuthName &quot;Blog&quot;
AuthType Basic
&nbsp;
require valid-user</pre></div></div>

 <img src="http://atastypixel.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=1600" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://atastypixel.com/blog/firming-up-wordpresss-security/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Private Tags WordPress Plugin</title>
		<link>http://atastypixel.com/blog/wordpress/plugins/private-tags/</link>
		<comments>http://atastypixel.com/blog/wordpress/plugins/private-tags/#comments</comments>
		<pubDate>Fri, 10 Apr 2009 09:23:17 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress Plugins]]></category>

		<guid isPermaLink="false">http://atastypixel.com/blog/2009/04/10/private-tags-wordpress-plugin/</guid>
		<description><![CDATA[The &#8220;Private Tags&#8221; WordPress plugin allows users to specify a list of tags or categories to keep hidden from the public &#8211; all posts within the specified tags/categories, and the tags/categories themselves, will not be visible to anyone but the original author. Alternatively, in &#8216;inclusive&#8217; mode specify a list of tags/categories to make public &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>The &#8220;Private Tags&#8221; WordPress plugin allows users to specify a list of tags or categories to keep hidden from the public &#8211; all posts within the specified tags/categories, and the tags/categories themselves, will not be visible to anyone but the original author.</p>

<p>Alternatively, in &#8216;inclusive&#8217; mode specify a list of tags/categories to make public &#8211; all other tags/categories will remain hidden.</p>

<p><span id="more-1586"></span></p>

<h2>Download</h2>

<p>Download the Private Tags plugin at the <a href="http://wordpress.org/extend/plugins/private-tags/">WordPress plugin page</a></p>

<p>If you like Private Tags, please consider buying one of my <a href="http://atastypixel.com/products">products</a>.</p>

<h3>Installation</h3>

<ol>
<li>Unzip the package, and upload <code>private-tags</code> to the <code>/wp-content/plugins/</code> directory</li>
<li>Activate the plugin through the &#8216;Plugins&#8217; menu in WordPress</li>
<li>Visit &#8216;Private Tags&#8217; settings underneath WordPress settings to configure</li>
</ol>

<h3>Changes</h3>

<p><em>0.1</em> &#8211; Initial release</p>
 <img src="http://atastypixel.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=1586" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://atastypixel.com/blog/wordpress/plugins/private-tags/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Great Elegant Grunge mods</title>
		<link>http://atastypixel.com/blog/great-elegant-grunge-mod/</link>
		<comments>http://atastypixel.com/blog/great-elegant-grunge-mod/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 10:27:12 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://atastypixel.com/blog/2009/03/30/great-elegant-grunge-mod/</guid>
		<description><![CDATA[I came across this beautiful Elegant Grunge modification today, at Gawariel.com. Fantastic! Here&#8217;s another cool one by Rodrigo Muñoz: And one from Nistha Tripathi:]]></description>
			<content:encoded><![CDATA[<p><img src="http://atastypixel.com/blog/wp-content/michaelangelo-images/f958dc6d85bda75e9a38699a765b56fb.jpg" width="500" height="378" alt="200903302038.jpg" title="200903302038.jpg" class="aligncenter polaroid noframe" /></p>

<p>I came across this beautiful Elegant Grunge modification today, at <a href="http://www.gawariel.com/">Gawariel.com</a>. Fantastic!</p>

<p>Here&#8217;s another cool one by <a href="http://acidrod.com.ar/">Rodrigo Muñoz</a>:</p>

<p><img src="http://atastypixel.com/blog/wp-content/michaelangelo-images/fc8da87feb74cc02339a62ff16d9c71b.jpg" width="500" height="428" alt="_3585_3350962677_59c4701a7d.jpg" title="_3585_3350962677_59c4701a7d.jpg" class="aligncenter polaroid noframe" /></p>

<p>And one from <a href="http://nisthaonweb.com/blog/">Nistha Tripathi</a>:</p>

<p><img src="http://atastypixel.com/blog/wp-content/michaelangelo-images/6b28d15c418cd633016f07c97ed24a65.jpg" width="500" height="394" alt="200905210921.jpg" title="200905210921.jpg" class="aligncenter polaroid noframe" /></p>
 <img src="http://atastypixel.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=1574" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://atastypixel.com/blog/great-elegant-grunge-mod/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Elegant Grunge PSD</title>
		<link>http://atastypixel.com/blog/elegant-grunge-psd/</link>
		<comments>http://atastypixel.com/blog/elegant-grunge-psd/#comments</comments>
		<pubDate>Sat, 17 Jan 2009 23:18:31 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress Themes]]></category>

		<guid isPermaLink="false">http://atastypixel.com/blog/2009/01/18/elegant-grunge-psd/</guid>
		<description><![CDATA[Due to popular demand, I&#8217;m making available the Elegant Grunge PSD, so that users can make modifications more easily. It can be downloaded here (5.5 Mb): A note on contacting me: Please don&#8217;t make direct contact asking about customisation, as I don&#8217;t have the resources to help you. These kind of questions should be directed [...]]]></description>
			<content:encoded><![CDATA[<p>Due to popular demand, I&#8217;m making available the Elegant Grunge PSD, so that users can make modifications more easily.  It can be downloaded here (5.5 Mb):</p>

<p><a href="http://atastypixel.com/blog/wp-content/uploads/2009/01/Elegant%20Grunge.psd.zip" title="Download Elegant Grunge.psd.zip"><img src="http://atastypixel.com/blog/wp-content/uploads/2009/01/200901181015.jpg" width="200" height="161" alt="Download Elegant Grunge.psd.zip" title="Download Elegant Grunge.psd.zip" class="aligncenter" /></a></p>

<p><small>A note on contacting me: Please don&#8217;t make direct contact asking about customisation, as I don&#8217;t have the resources to help you. These kind of questions should be directed to the <a href="http://wordpress.org/support/">WordPress forums</a>. Thanks!</small></p>

<p>If you like Elegant Grunge, please consider buying one of my <a href="http://atastypixel.com/products">products</a>.</p>
 <img src="http://atastypixel.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=1290" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://atastypixel.com/blog/elegant-grunge-psd/feed/</wfw:commentRss>
		<slash:comments>32</slash:comments>
		</item>
		<item>
		<title>Elegant Grunge 1.0 released</title>
		<link>http://atastypixel.com/blog/elegant-grunge-10-released/</link>
		<comments>http://atastypixel.com/blog/elegant-grunge-10-released/#comments</comments>
		<pubDate>Mon, 29 Dec 2008 11:12:06 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress Themes]]></category>

		<guid isPermaLink="false">http://atastypixel.com/blog/2008/12/29/elegant-grunge-10-released/</guid>
		<description><![CDATA[A significant update to my WordPress theme, Elegant Grunge, has been released. New features and fixes include: Configurable sidebars! Choose from no sidebar, a sidebar on the right (the standard layout), or a double sidebar on the right! Support for WP 2.7 paginated and threaded comments Support for a custom header image &#8211; just enter [...]]]></description>
			<content:encoded><![CDATA[<p>A significant update to my WordPress theme, <a href="http://atastypixel.com/blog/wordpress/themes/elegant-grunge/">Elegant Grunge</a>, has been released. New features and fixes include:</p>

<ul>
<li>Configurable sidebars! Choose from no sidebar, a sidebar on the right (the standard layout), or a double sidebar on the right!</li>
<li>Support for WP 2.7 paginated and threaded comments</li>
<li>Support for a custom header image &#8211; just enter a URL to an image, typically a transparent PNG, and it will appear in the header instead of the text (SEO friendly)</li>
<li>Some bug, compatibility and i18n fixes</li>
</ul>

<p>&lt;</p>

<p>p>Note: If you have problems with this theme, please post your question at the <a href="http://wordpress.org/tags/elegant-grunge">WordPress forums</a>.  Please don&#8217;t contact me directly, as I don&#8217;t have the resources to help you.</p>
 <img src="http://atastypixel.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=1249" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://atastypixel.com/blog/elegant-grunge-10-released/feed/</wfw:commentRss>
		<slash:comments>66</slash:comments>
		</item>
		<item>
		<title>Custom Permalinks</title>
		<link>http://atastypixel.com/blog/wordpress/plugins/custom-permalinks/</link>
		<comments>http://atastypixel.com/blog/wordpress/plugins/custom-permalinks/#comments</comments>
		<pubDate>Sat, 01 Nov 2008 07:48:51 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress Plugins]]></category>

		<guid isPermaLink="false">http://atastypixel.com/blog/2008/11/01/custom-permalinks/</guid>
		<description><![CDATA[Custom Permalinks is a Wordpress plugin that gives you ultimate control over your site structure by freely configuring URLs for posts, tags and categories.]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://atastypixel.com/blog/wp-content/uploads/2008/11/200811011939.jpg" rel="lightbox[1042]"><img src="http://atastypixel.com/blog/wp-content/uploads/2008/11/200811011939-tm.jpg" width="300" height="164" alt="200811011939.jpg" title="200811011939.jpg" /></a></p>

<p>Custom Permalinks is a WordPress plugin that gives you ultimate control over your site structure.</p>

<p>Lay out your site the way <em>you</em> want it. Set the URL of any post, tag or category to anything you want. Old permalinks will redirect properly to the new address.</p>

<p><span id="more-1042"></span></p>

<h3>Download</h3>

<p>Download Custom Permalinks for WordPress from the <a href="http://wordpress.org/extend/plugins/custom-permalinks/">Custom Permalinks WordPress plugin</a> page.</p>

<p>If you like Custom Permalinks, please consider buying one of my <a href="http://atastypixel.com/products">products</a>.</p>

<h3>Installation</h3>

<ol>
  <li>Unzip the package, and upload &#8216;custom-permalinks&#8217; to the &#8216;/wp-content/plugins/&#8217; directory</li>

  <li>Activate the plugin through the &#8216;Plugins&#8217; menu in WordPress</li>

  <li>Edit any post, tag or category to set a custom permalink.</li>
</ol>

<h3>Configuration</h3>

<ul>
  <li>Open or create a post, tag, or category.</li>

  <li>Under &#8216;Custom Permalink&#8217;, type in a URL, not including the http://domain part of the address.<br /></li>

  <li>Save</li>
</ul>

<p>Now, the post/tag/category will be accessible at the custom address.</p>

<p>Incoming visitors from old links will be redirected via a 301 redirect to the new address.</p>

<p>See Custom Permalinks in action right here! (See the address you&#8217;re currently at?)</p>

<h3>Notes</h3>

<h4>Interacting with other plugins which modify the URL</h4>

<p>If you notice that some plugins, such as Keyvan Minoukadeh&#8217;s <a href="http://www.keyvan.net/code/paged-comments/">Paged Comments</a> plugin, are not operating correctly, then ensure that your custom permalinks have a trailing slash (or not, if your standard permalinks do not have trailing slashes).</p>

<p>The Paged Comments plugin, and possibly others, work by adding a path component to the URL to signify state (eg. /comment-page-1), then hiding that path component from WordPress.</p>

<p>If you have a custom permalink with a different trailing / configuration to your normal permalinks (i.e., your custom permalink has a trailing / when others don&#8217;t, or vice versa),  you will notice that these plugins no longer work, because Custom Permalinks is correcting the URL, which overwrites the plugin&#8217;s changes.</p>

<p>If you notice this happening, make sure you have a trailing / on your permalink, or remove the trailing slash if your standard permalinks do not have a trailing /.</p>

<h4>Hiding the custom_permalinks custom field</h4>

<p>A user recently asked for this; I&#8217;m not going to include it in the plugin (some people, including me, want to see this field, because we set it manually sometimes), but I&#8217;m happy to make a plugin-let to make it happen.</p>

<p>Here it is: <a href="http://atastypixel.com/blog/wp-content/uploads/2010/01/hide_custom_permalink_field.php_.zip" title="hide_custom_permalink_field.php.zip">hide_custom_permalink_field.php.zip</a></p>

<p>Put it in your <code>wp-content/plugins</code> folder and turn it on in Plugins under WP admin.</p>

<h3>FAQ</h3>

<h4>I just get a &#8220;404 error&#8221; message when I try to visit a custom permalink</h4>

<p>Have you configured your default permalinks to be other than the default &#8220;?p=123&#8243; style?  If not, you probably haven&#8217;t got URL rewriting enabled.  Either set your permalinks to one of the other options (or a custom layout), or add the following to your <code>.htaccess</code> file in your webroot, creating this file if necessary:</p>

<p><pre>
&lt;IfModule mod_rewrite.c&gt;
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
&lt;/IfModule&gt;
</pre></p>

<h3>History</h3>

<p><strong>Version 0.6.1:</strong> Fix bug causing incorrect link from &#8220;View Post&#8221;/&#8221;View Page&#8221; button in post/page editor</p>

<p><strong>Version 0.6:</strong> Fix infinite redirect for permalinks ending in a / (critical fix), and moved post/page permalinks settings to top of edit form, replacing prior permalink display</p>

<p><strong>Version 0.5.3:</strong> Fix for invalid URL redirect (eg. http://domain.comfolder/file.html instead of http://domain.com/folder/file.html) when using permalinks without a trailing slash (like &#8230;/%postname%.html)</p>

<p><strong>Version 0.5.2:</strong> Bugfix for matching posts when there are multiple posts that match parts of the query</p>

<p><strong>Version 0.5.1:</strong> Compatibility fix for WP 2.7&#8242;s tag/category pages</p>

<p><strong>Version 0.5:</strong> Support for installations in subdirectories (i.e. not located at the webroot). This should make Custom Permalinks start working for many people.</p>

<p><strong>Version 0.4.1:</strong> WP 2.7 compatability fixes; fix for bug encountered when publishing a draft, or reverting to draft status, and fix for placeholder permalink value for pages</p>

<p><strong>Version 0.4:</strong> Added support for pages, and fixed a bug concerning post drafts.</p>

<p><strong>Version 0.3:</strong> Largely rewritten to provide more robust handling of trailing slashes, proper support for trailing URL components (eg. paging)</p>

<p><strong>Version 0.2:</strong> Added management page to display all custom permalinks, with an option to revert selected items</p>

<p><strong>Version 0.1.1</strong>: Fixed problem with categories</p>

<p><strong>Version 0.1</strong>: Initial release</p>
 <img src="http://atastypixel.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=1042" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://atastypixel.com/blog/wordpress/plugins/custom-permalinks/feed/</wfw:commentRss>
		<slash:comments>142</slash:comments>
		</item>
		<item>
		<title>&#8216;Paged Comments&#8217; plugin theme for Elegant Grunge</title>
		<link>http://atastypixel.com/blog/paged-comments-plugin-theme-for-elegant-grunge/</link>
		<comments>http://atastypixel.com/blog/paged-comments-plugin-theme-for-elegant-grunge/#comments</comments>
		<pubDate>Thu, 30 Oct 2008 22:41:21 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://atastypixel.com/blog/2008/10/31/paged-comments-plugin-theme-for-elegant-grunge/</guid>
		<description><![CDATA[I&#8217;ve recently enabled the Paged Comments plugin for this site, as the comments over at the Elegant Grunge page were getting a little large in number. A few tweaks were required to make it look right, though. So, here&#8217;s the Elegant Grunge theme for the plugin &#8211; put this in the &#8216;themes&#8217; directory under the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently enabled the <a href="http://wordpress.org/extend/plugins/paged-comments/download/">Paged Comments</a> plugin for this site, as the comments over at the Elegant Grunge page were getting a little large in number. A few tweaks were required to make it look right, though.</p>

<p>So, here&#8217;s the Elegant Grunge theme for the plugin &#8211; put this in the &#8216;themes&#8217; directory under the &#8216;paged-comments&#8217; plugin directory.</p>

<p><a href="http://atastypixel.com/blog/wp-content/uploads/2008/10/elegant-grunge-for-paged-comments.zip" title="elegant-grunge-for-paged-comments.zip">elegant-grunge-for-paged-comments.zip</a></p>
 <img src="http://atastypixel.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=1022" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://atastypixel.com/blog/paged-comments-plugin-theme-for-elegant-grunge/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
