<?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/"
	xmlns:media="http://search.yahoo.com/mrss"
>

<channel>
	<title>Deep Thoughts by Robert Felty &#187; wordpress</title>
	<atom:link href="http://blog.robfelty.com/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.robfelty.com</link>
	<description>thoughts on wordpress, latex, cooking et alia</description>
	<lastBuildDate>Wed, 04 Aug 2010 21:56:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>New WordPress plugin &#8211; Image Browser</title>
		<link>http://blog.robfelty.com/2010/08/04/new-wordpress-plugin-image-browser/</link>
		<comments>http://blog.robfelty.com/2010/08/04/new-wordpress-plugin-image-browser/#comments</comments>
		<pubDate>Wed, 04 Aug 2010 21:55:03 +0000</pubDate>
		<dc:creator>robfelty</dc:creator>
				<category><![CDATA[photography]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://blog.robfelty.com/?p=687</guid>
		<description><![CDATA[Today I released my 8th wordpress plugin. This one is quite a bit different from all the other plugins I have written. A friend of mine was looking for a way to create a gallery on his family blog. &#8220;No problem!&#8221;, I told him, &#8220;there are lots of plugins for that&#8221;. But I then quickly [...]]]></description>
			<content:encoded><![CDATA[<p><div id="attachment_689" class="wp-caption alignleft" style="width: 260px"><a href="http://blog.robfelty.com/2010/08/04/new-wordpress-plugin-image-browser/image-browser-2/" rel="attachment wp-att-689"><img src="http://blog.robfelty.com/wp-content/uploads/2010/08/image-browser-2-250x258.png" alt="Screenshot of image browser plugin in action" title="image-browser-2" width="250" height="258" class="size-medium wp-image-689" /></a><p class="wp-caption-text">Screenshot of image browser plugin in action</p></div> Today I released my 8th wordpress plugin. This one is quite a bit different from all the other plugins I have written. A friend of mine was looking for a way to create a gallery on his family blog. &#8220;No problem!&#8221;, I told him, &#8220;there are lots of plugins for that&#8221;. But I then quickly realized that no plugins were available for what he was looking for. All of the other image gallery plugins for wordpress function by creating galleries manually, say a gallery of wedding photos, or a gallery of a trip to the zoo. My friend was looking for an easy way to browse all pictures he has ever posted on his blog. That is what the <a href='http://wordpress.org/extend/plugins/image-browser/'>Image Browser plugin</a> does. It allows you to browse through all of your pictures on your blog, and also allows you to restrict by year, month, category, and by caption text. It is easy to install and use. Simply install it, then create a new page, and insert the [imagebrowser] shortcode. That&#8217;s it. Options can be set either in the settings page, or by using shortcode parameters. If you would like a demo, please take a spin at my <a href='http://fedibblety.com/gallery'>family blog gallery</a>, or the <a href='/plugins/image-browser'>image browser page</a> on this site.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.robfelty.com/2010/08/04/new-wordpress-plugin-image-browser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://blog.robfelty.com/wp-content/uploads/2010/08/image-browser-2-250x258.png" />
		<media:content url="http://blog.robfelty.com/wp-content/uploads/2010/08/image-browser-2-250x258.png" medium="image">
			<media:title type="html">image-browser-2</media:title>
		</media:content>
	</item>
		<item>
		<title>New wordpress plugin &#8211; Image Meta</title>
		<link>http://blog.robfelty.com/2010/06/22/new-wordpress-plugin-image-meta/</link>
		<comments>http://blog.robfelty.com/2010/06/22/new-wordpress-plugin-image-meta/#comments</comments>
		<pubDate>Tue, 22 Jun 2010 19:59:46 +0000</pubDate>
		<dc:creator>robfelty</dc:creator>
				<category><![CDATA[photography]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://blog.robfelty.com/?p=680</guid>
		<description><![CDATA[I just released my 7th wordpress plugin, Image Meta. This one has to do with image handling. Before wordpress 3.0, when you uploaded an image, the filename of the image was set as the title, and if you had given the image a caption (e.g. with Picasa), then the IPTC caption would be used as [...]]]></description>
			<content:encoded><![CDATA[<p><div id="attachment_681" class="wp-caption alignleft" style="width: 260px"><a href="http://blog.robfelty.com/2010/06/22/new-wordpress-plugin-image-meta/image-meta/" rel="attachment wp-att-681"><img src="http://blog.robfelty.com/wp-content/uploads/2010/06/image-meta-250x159.png" alt="Image meta options" title="image-meta" width="250" height="159" class="size-medium wp-image-681" /></a><p class="wp-caption-text">Image meta options</p></div> I just released my 7th wordpress plugin, <a href='http://wordpress.org/extend/plugins/image-meta'>Image Meta</a>. This one has to do with image handling. Before wordpress 3.0, when you uploaded an image, the filename of the image was set as the title, and if you had given the image a caption (e.g. with Picasa), then the IPTC caption would be used as the caption for the image. In wordpress 3.0, the default is now to use the caption for the title of the image. I don&#8217;t like this, mostly because I had set up my theme&#8217;s image handling based on the old way. So I decided to write a little plugin which hooks into the image uploading process, and sets all four image fields at once &#8211; the title, alt text, caption, and description. The plugin allows you to select between setting each field to either the filename, the IPTC caption, or leaving it blank. I hope some others find it useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.robfelty.com/2010/06/22/new-wordpress-plugin-image-meta/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:thumbnail url="http://blog.robfelty.com/wp-content/uploads/2010/06/image-meta-250x159.png" />
		<media:content url="http://blog.robfelty.com/wp-content/uploads/2010/06/image-meta-250x159.png" medium="image">
			<media:title type="html">image-meta</media:title>
		</media:content>
	</item>
		<item>
		<title>New wordpress plugin &#8211; category reminder</title>
		<link>http://blog.robfelty.com/2010/04/01/new-wordpress-plugin-category-reminder/</link>
		<comments>http://blog.robfelty.com/2010/04/01/new-wordpress-plugin-category-reminder/#comments</comments>
		<pubDate>Thu, 01 Apr 2010 18:44:57 +0000</pubDate>
		<dc:creator>robfelty</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://blog.robfelty.com/?p=654</guid>
		<description><![CDATA[I recently released my sixth wordpress plugin &#8211; category reminder. I have seen several requests around for a plugin which forces users to select a category for each post they publish, so that the posts don&#8217;t just end up as uncategorized. Bloggers with multiple authors seem especially interested in this. I have wanted this requirement [...]]]></description>
			<content:encoded><![CDATA[<p><div id="attachment_655" class="wp-caption aligncenter" style="width: 610px"><a href="http://blog.robfelty.com/2010/04/01/new-wordpress-plugin-category-reminder/screenshot-1-2/" rel="attachment wp-att-655"><img src="http://blog.robfelty.com/wp-content/uploads/2010/04/screenshot-1-600x327.png" alt="Category reminder screenshot" title="screenshot-1" width="600" height="327" class="size-large wp-image-655" /></a><p class="wp-caption-text">Category reminder screenshot</p></div> I recently released my sixth wordpress plugin &#8211; <a href='http://wordpress.org/extend/plugins/category-reminder'>category reminder</a>. I have seen several requests around for a plugin which forces users to select a category for each post they publish, so that the posts don&#8217;t just end up as uncategorized. Bloggers with multiple authors seem especially interested in this. I have wanted this requirement for myself as well, since I sometimes forget to categorize a post before publishing it. Now users can easily add this functionality via this plugin.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.robfelty.com/2010/04/01/new-wordpress-plugin-category-reminder/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:thumbnail url="http://blog.robfelty.com/wp-content/uploads/2010/04/screenshot-1-600x327.png" />
		<media:content url="http://blog.robfelty.com/wp-content/uploads/2010/04/screenshot-1-600x327.png" medium="image">
			<media:title type="html">screenshot-1</media:title>
		</media:content>
	</item>
		<item>
		<title>Multi-column balanced lists</title>
		<link>http://blog.robfelty.com/2010/02/18/multi-column-balanced-lists/</link>
		<comments>http://blog.robfelty.com/2010/02/18/multi-column-balanced-lists/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 17:25:36 +0000</pubDate>
		<dc:creator>robfelty</dc:creator>
				<category><![CDATA[(x)html]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://blog.robfelty.com/?p=626</guid>
		<description><![CDATA[Recently I was working on a project where a client wanted a list of items to be displayed over multiple columns, and requested that the columns be balanced (as balanced as possible). It didn&#8217;t take me too long to figure out how to do this for 3 columns, but I knew that there was a [...]]]></description>
			<content:encoded><![CDATA[<p><div id="attachment_627" class="wp-caption alignleft" style="width: 260px"><img src="http://blog.robfelty.com/wp-content/uploads/2010/01/balanced-columns-250x187.png" alt="List with balanced columns" title="balanced-columns" width="250" height="187" class="size-medium wp-image-627" /><p class="wp-caption-text">List with balanced columns</p></div> <div id="attachment_630" class="wp-caption alignleft" style="width: 260px"><img src="http://blog.robfelty.com/wp-content/uploads/2010/01/unbalanced-columns-250x196.png" alt="List with unbalanced columns" title="unbalanced-columns" width="250" height="196" class="size-medium wp-image-630" /><p class="wp-caption-text">List with unbalanced columns</p></div> Recently I was working on a project where a client wanted a list of items to be displayed over multiple columns, and requested that the columns be balanced (as balanced as possible). It didn&#8217;t take me too long to figure out how to do this for 3 columns, but I knew that there was a more general solution, which did take me a little time to figure out. I am sharing my solution here for my future reference. Perhaps some one else will find it useful too. The solution is in php, though the general algorithm should apply to any language. </p>
<p>The intuition that led me to this solution was to examine unbalanced columns. Let&#8217;s look at the case of 5 columns with 56 items, as shown in the figures. It quickly becomes obvious that you need 12 items per column (<tt>ceil(56/5)</tt>). However, this yields columns of lengths 12, 12, 12, 12 and 8. If you decrease the number of total items to 55, then you have balanced columns of 11. If you increase the number of items to 60, you have balanced columns of 12. Thus, it is possible for the last column to have <em>n-1</em> items less than the other columns, where <em>n</em> is the number of columns. The preferred output is to have columns of 12, 11, 11, 11, and 11. So what we are doing is shifting over elements from columns 2, 3, and 4 to column 5 (note that we are not messing with the order of the elements). We can always achieve the desired result by simply decreasing the number of items from some of the columns by 1. To determine which columns to decrease, we simply look at the difference in the number of elements per column in the unbalanced solution. In the case of 5 columns with 56 items, the last column would only have 8 items, which is 4 less than 12. So we should start reducing the number of items per column at the 2nd column (<em>(5-4)+1</em>). If we had 57 items total, we would start reducing at the 3rd column (<em>(5-3)+1</em>). </p>
<p>Here is the snippet of code which takes care of figuring this out:</p>
<div class="codecolorer-container php dawn" style="overflow:auto;white-space:nowrap;width:100"><div class="php codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="re0">$numCols</span> <span class="sy0">=</span> <span class="nu0">5</span><span class="sy0">;</span><br />
<span class="re0">$numItems</span> <span class="sy0">=</span> <span class="nu0">56</span><span class="sy0">;</span><br />
<span class="re0">$itemsPerCol</span> <span class="sy0">=</span> <span class="kw3">ceil</span><span class="br0">&#40;</span><span class="re0">$numItems</span> <span class="sy0">/</span> <span class="re0">$numCols</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="re0">$adjustedItemsPerCol</span><span class="sy0">=</span><span class="re0">$itemsPerCol</span><span class="sy0">;</span><br />
<span class="re0">$blank</span> <span class="sy0">=</span><span class="re0">$itemsPerCol</span> <span class="sy0">-</span> <span class="br0">&#40;</span><span class="re0">$numItems</span> <span class="sy0">%</span> <span class="re0">$itemsPerCol</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="kw1">if</span> <span class="br0">&#40;</span><span class="re0">$blank</span><span class="sy0">!=</span><span class="re0">$itemsPerCol</span> <span class="sy0">&amp;&amp;</span> <span class="re0">$blank</span> <span class="sy0">&gt;</span><span class="nu0">0</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; <span class="re0">$adjustedItemsPerCol</span><span class="sy0">--;</span><br />
<span class="br0">&#125;</span></div></div>
<p>While we are looping over our array of items (or, in my example case, using a while loop), we check to see which column  we are on, and if we are on the column where we start to decrease the number of items per column, then we switch <tt>$itemsPerCol</tt> to <tt>$adjustedItemsPerCol</tt>.</p>
<div class="codecolorer-container php dawn" style="overflow:auto;white-space:nowrap;width:100"><div class="php codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="kw1">if</span> <span class="br0">&#40;</span><span class="re0">$colNum</span> <span class="sy0">==</span> <span class="br0">&#40;</span><span class="re0">$numCols</span> <span class="sy0">-</span> <span class="re0">$blank</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; <span class="re0">$itemsPerCol</span><span class="sy0">=</span><span class="re0">$adjustedItemsPerCol</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div></div>
<p>Feel free to look at this <a href='http://robfelty/examples/columns-balanced.php'>working example</a>, along with the <a href='http://robfelty/examples/columns-balanced.phps'>code</a> for it. I have used the CSS float property to make the divs act like columns, and added some colors to help them stand out. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.robfelty.com/2010/02/18/multi-column-balanced-lists/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://blog.robfelty.com/wp-content/uploads/2010/01/balanced-columns-250x187.png" />
		<media:content url="http://blog.robfelty.com/wp-content/uploads/2010/01/balanced-columns-250x187.png" medium="image">
			<media:title type="html">balanced-columns</media:title>
		</media:content>

		<media:thumbnail url="http://blog.robfelty.com/wp-content/uploads/2010/01/unbalanced-columns-250x196.png" />
		<media:content url="http://blog.robfelty.com/wp-content/uploads/2010/01/unbalanced-columns-250x196.png" medium="image">
			<media:title type="html">unbalanced-columns</media:title>
		</media:content>
	</item>
		<item>
		<title>WordPress 2.9 image changes</title>
		<link>http://blog.robfelty.com/2010/01/02/wordpress-2-9-image-changes/</link>
		<comments>http://blog.robfelty.com/2010/01/02/wordpress-2-9-image-changes/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 22:58:48 +0000</pubDate>
		<dc:creator>robfelty</dc:creator>
				<category><![CDATA[sql]]></category>
		<category><![CDATA[wiki/cms]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://blog.robfelty.com/?p=534</guid>
		<description><![CDATA[WordPress 2.9 has several new image enhancements. One of the biggest features is some basic image editing functionality. Another one is that you can now specify different alt text from the &#8220;caption&#8221; field. The &#8220;caption&#8221; field places a caption under the image. The &#8220;alt&#8221; text is used to describe the picture to non-seeing users (including [...]]]></description>
			<content:encoded><![CDATA[<p>WordPress 2.9 has several new image enhancements. One of the biggest features is some basic image editing functionality. Another one is that you can now specify different alt text from the &#8220;caption&#8221; field. The &#8220;caption&#8221; field places a caption under the image. The &#8220;alt&#8221; text is used to describe the picture to non-seeing users (including search engines). This is a nice addition. However, I usually like my caption, alt text, and title text to be all the same, and I don&#8217;t like to have to enter it all manually or copy and paste. By default, wordpress will use an IPTC caption as its &#8220;description&#8221; field, which shows up in the title attribute of the image. This is nice, since I can add a caption in my image editing program of choice (Picasa) and then I don&#8217;t have to enter it again. Except for those pesky alt and caption fields, which are blank by default. </p>
<p>This is particularly important if I am uploading many pictures. So I wrote a little sql which will set the &#8220;caption&#8221; and &#8220;alt text&#8221; fields to be the same as the description. I already had this working for the &#8220;caption&#8221; field for quite some time, but getting it to work for the different alt text handling in 2.9 was a bit tricky, since I discovered that the alt text is not stored in wp_posts like the other fields. Instead it is stored in the wp_postmeta table, which is new in 2.9. Although it took me awhile to figure this out, the new table is a welcome addition. Now for each image you upload, wordpress stores meta information in this table, including the width and height, different sized versions of the file, the IPTC caption, some EXIF info and a few other goodies. This means that if you like to include EXIF info about your pictures, that doing so requires only a simple database lookup, instead of having to read the headers from the image, which should be considerably faster I would imagine. </p>
<p>Now for my little SQL which sets the &#8220;caption&#8221; and &#8220;alt text&#8221; to be the same as the description. I run this on my server after uploading pictures. It would be even better if I could figure out how to do this as a wordpress plugin.</p>
<div class="codecolorer-container sql dawn" style="overflow:auto;white-space:nowrap;width:100"><div class="sql codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="co1">-- First we set the image caption (post_excerpt) to be the same as the</span><br />
<span class="co1">-- description (post_content)</span><br />
<span class="kw1">UPDATE</span> wp_posts <span class="kw1">SET</span> post_excerpt<span class="sy0">=</span>post_content <span class="kw1">WHERE</span> post_type<span class="sy0">=</span><span class="st0">'attachment'</span> <span class="kw1">AND</span><br />
date<span class="br0">&#40;</span>post_date<span class="br0">&#41;</span><span class="sy0">=</span>curdate<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
<br />
<span class="co1">-- Next we set the alternative text to be the same as the post_excerpt</span><br />
<span class="kw1">INSERT</span> <span class="kw1">INTO</span> wp_postmeta <span class="br0">&#40;</span>wp_postmeta<span class="sy0">.</span>post_id<span class="sy0">,</span> wp_postmeta<span class="sy0">.</span>meta_value<span class="br0">&#41;</span> <span class="kw1">SELECT</span><br />
<span class="kw1">DISTINCT</span> wp_posts<span class="sy0">.</span>ID<span class="sy0">,</span> wp_posts<span class="sy0">.</span>post_excerpt <span class="kw1">FROM</span> wp_posts<span class="sy0">,</span> wp_postmeta <span class="kw1">WHERE</span><br />
wp_posts<span class="sy0">.</span>ID<span class="sy0">=</span>wp_postmeta<span class="sy0">.</span>post_id <span class="kw1">AND</span> post_type<span class="sy0">=</span><span class="st0">'attachment'</span> <span class="kw1">AND</span><br />
date<span class="br0">&#40;</span>post_date<span class="br0">&#41;</span><span class="sy0">=</span>curdate<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
<br />
<span class="co1">-- This line sets the correct meta_key for the previous line, which doesn't</span><br />
<span class="co1">-- seem possible otherwise</span><br />
<span class="kw1">UPDATE</span> wp_postmeta <span class="kw1">SET</span> meta_key<span class="sy0">=</span><span class="st0">'_wp_attachment_image_alt'</span> <span class="kw1">WHERE</span> meta_key <span class="kw1">IS</span><br />
<span class="kw1">NULL</span>;</div></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.robfelty.com/2010/01/02/wordpress-2-9-image-changes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing your own custom filters for postie</title>
		<link>http://blog.robfelty.com/2009/08/24/writing-your-own-custom-filters-for-postie/</link>
		<comments>http://blog.robfelty.com/2009/08/24/writing-your-own-custom-filters-for-postie/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 19:00:03 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[postie]]></category>

		<guid isPermaLink="false">http://blog.robfelty.com/?p=456</guid>
		<description><![CDATA[In version 1.3.1 of postie, it is now easy to add custom filters to the content of your posts. Best of all, by using filters, you can easily write your own plugin, which will not be affected by upgrades to postie (as opposed to modifying the postie functions directly). There are two examples now included [...]]]></description>
			<content:encoded><![CDATA[<p>In version 1.3.1 of <a href='http://wordpress.org/extend/plugin/postie' title='the wordpress plugin which offers many advanced features for posting to  your blog via e-mail'>postie</a>, it is now easy to add custom filters to the  content of your posts. Best of all, by using filters, you can easily write your  own plugin, which will not be affected by upgrades to postie (as opposed to  modifying the postie functions directly). There are two examples now included  in version 1.3.1 of postie, in the <a href='http://robfelty/test28/wp-content/plugins/postie/filterPostie.phps' >filterPostie.php</a> file. Here is how to write  your own filter.
<ol>
<li>Copy the filterPostie.php into your plugins directory</li>
<li>Change the metadata at the top of the file, such as the author and plugin  name</li>
<li>Modify the example functions to your liking, or create your own</li>
<li>Activate the plugin</li>
</ol>
<p> A few more details. After modifying the headers, you might have something like  the following:</p>
<div class="codecolorer-container php dawn" style="overflow:auto;white-space:nowrap;width:100"><div class="php codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="coMULTI">/* Plugin Name: My own Postie Filter Plugin <br />
URI: http://mywebsite<br />
Description: Adds a custom field to each post called postie <br />
Version: 0.1 Author: Joe Bloe <br />
Author URI: http://mywebsite.com <br />
*/</span></div></div>
<p>Just as with any filter for wordpress, you have 2 parts.
<ol>
<li>A function which receives an argument, makes some modifications  (filtering) and returns a result</li>
<li>A function call to add this new function to the list of filters for a  certain action</li>
</ol>
<p> As you can see in the example file, I have created two functions,  <tt>filter_title</tt>, and <tt>filter_content</tt>. After creating these  functions, I then &#8220;hook&#8221; them into postie using the <tt>add_filter</tt>  function.</p>
<div class="codecolorer-container php dawn" style="overflow:auto;white-space:nowrap;width:100"><div class="php codecolorer" style="font-family:Monaco,Lucida Console,monospace">add_filter<span class="br0">&#40;</span><span class="st_h">'postie_post'</span><span class="sy0">,</span> <span class="st_h">'filter_title'</span><span class="br0">&#41;</span><span class="sy0">;</span> <br />
add_filter<span class="br0">&#40;</span><span class="st_h">'postie_post'</span><span class="sy0">,</span> <span class="st_h">'filter_content'</span><span class="br0">&#41;</span><span class="sy0">;</span></div></div>
<p>Now lets create our new function to add a custom field</p>
<div class="codecolorer-container php dawn" style="overflow:auto;white-space:nowrap;width:100"><div class="php codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="kw2">function</span> add_custom_field<span class="br0">&#40;</span><span class="re0">$post</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; <span class="co1">//this function appends &quot;(via postie)&quot; to the title (subject)</span><br />
&nbsp; add_post_meta<span class="br0">&#40;</span><span class="re0">$post</span><span class="br0">&#91;</span><span class="st_h">'ID'</span><span class="br0">&#93;</span><span class="sy0">,</span> <span class="st_h">'postie'</span><span class="sy0">,</span> <span class="st_h">'postie'</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; <span class="kw1">return</span> <span class="br0">&#40;</span><span class="re0">$post</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div></div>
<p>Finally, we let wordpress know that this function should filter any post that  is sent via postie</p>
<div class="codecolorer-container php dawn" style="overflow:auto;white-space:nowrap;width:100"><div class="php codecolorer" style="font-family:Monaco,Lucida Console,monospace">add_filter<span class="br0">&#40;</span><span class="st_h">'postie_post'</span><span class="sy0">,</span> <span class="st_h">'add_custom_field'</span><span class="br0">&#41;</span><span class="sy0">;</span></div></div>
<p>Currently our function is really not that useful, since the key and value of  our custom field are the same. However, there is really very little limit to  what we can do with filters. Perhaps a more useful function would be an auto- tagger. Suppose I often write about cooking, wordpress, and latex (which I  do). But when I am posting via e-mail, I frequently forget to add tags. We  could write a little filter function to read the body of the post, and  automatically add tags depending on the content. Here is what it might look  like:</p>
<div class="codecolorer-container php dawn" style="overflow:auto;white-space:nowrap;width:100"><div class="php codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="kw2">function</span> auto_tag<span class="br0">&#40;</span><span class="re0">$post</span><span class="br0">&#41;</span> <span class="br0">&#123;</span> &nbsp;<br />
&nbsp; <span class="co1">// this function automatically inserts tags for a post &nbsp; </span><br />
&nbsp; <span class="re0">$my_tags</span><span class="sy0">=</span><span class="kw3">array</span><span class="br0">&#40;</span><span class="st_h">'cooking'</span><span class="sy0">,</span> <span class="st_h">'latex'</span><span class="sy0">,</span> <span class="st_h">'wordpress'</span><span class="br0">&#41;</span><span class="sy0">;</span> &nbsp; <br />
&nbsp; <span class="kw1">foreach</span> <span class="br0">&#40;</span><span class="re0">$my_tags</span> <span class="kw1">as</span> <span class="re0">$my_tag</span><span class="br0">&#41;</span> <span class="br0">&#123;</span> &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>stripos<span class="br0">&#40;</span><span class="re0">$post</span><span class="br0">&#91;</span><span class="st_h">'post_content'</span><span class="br0">&#93;</span><span class="sy0">,</span> <span class="re0">$my_tag</span><span class="br0">&#41;</span><span class="sy0">!==</span><span class="kw2">false</span><span class="br0">&#41;</span> &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; <span class="kw3">array_push</span><span class="br0">&#40;</span><span class="re0">$post</span><span class="br0">&#91;</span><span class="st_h">'tags_input'</span><span class="br0">&#93;</span><span class="sy0">,</span> <span class="re0">$my_tag</span><span class="br0">&#41;</span><span class="sy0">;</span> &nbsp; <br />
&nbsp; <span class="br0">&#125;</span> &nbsp; <br />
&nbsp; <span class="kw1">return</span> <span class="br0">&#40;</span><span class="re0">$post</span><span class="br0">&#41;</span><span class="sy0">;</span> <br />
<span class="br0">&#125;</span> <br />
add_filter<span class="br0">&#40;</span><span class="st_h">'postie_post'</span><span class="sy0">,</span> <span class="st_h">'auto_tag'</span><span class="br0">&#41;</span><span class="sy0">;</span></div></div>
<p>I&#8217;m sure that users will come up with many other interesting filters. If you  develop any you would like to share, please post them on the <a href='http://forum.robfelty.com/forum/postie'>postie forum</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.robfelty.com/2009/08/24/writing-your-own-custom-filters-for-postie/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Blogging with LaTeX</title>
		<link>http://blog.robfelty.com/2009/08/18/blogging-with-latex/</link>
		<comments>http://blog.robfelty.com/2009/08/18/blogging-with-latex/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 15:22:17 +0000</pubDate>
		<dc:creator>robfelty</dc:creator>
				<category><![CDATA[(x)html]]></category>
		<category><![CDATA[latex]]></category>
		<category><![CDATA[wiki/cms]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[plastex]]></category>
		<category><![CDATA[xmlrpc]]></category>

		<guid isPermaLink="false">http://blog.robfelty.com/?p=455</guid>
		<description><![CDATA[The first question on reader&#8217;s mind must be &#8212; why use LaTeX to blog? Well, I have a pretty specific instance in mind, but I can imagine that others might be interested as well. This fall I am teaching a course on computational corpus linguistics at CU Boulder. I like to have some materials online [...]]]></description>
			<content:encoded><![CDATA[<p>The first question on reader&#8217;s mind must be &mdash; why use LaTeX to blog?</p>
<p>Well, I have a pretty specific instance in mind, but I can imagine that others might be interested as well. This fall I am teaching a course on computational corpus linguistics at CU Boulder. I like to have some materials online for the students, such as the syllabus, course notes, etc. I thought about setting up a simple webpage, but then I decided instead to use wordpress, because it would give me extra functionality, such as auto-generating rss feeds, and with some plugins, would allow me to notify students via e-mail when I post lecture notes or slides, or homework tips. The one drawback I could see is that it would be hard to update the syllabus throughout the semester, as I tend to change the calendar some throughout the semester. Then I thought that maybe I could hack up a quick xml-rpc solution to the problem, and about an hour later, I had it done. All I needed was the WordPress::API perl module from CPAN. </p>
<p>Now I have a handy little publish script which first compiles my syllabus as pdf, then compiles it as html using plasTeX. Then I run it through tidy for formatting and hack in a few more things. Then I update the syllabus page on the course blog via xml-rpc. Finally, I rsync the pdf to the server. And with the post-notification plugin for wordpress, students will get an e-mail when the syllabus is updated. </p>
<p>Here are the scripts:</p>
<h3>publish</h3>
<div class="codecolorer-container bash dawn" style="overflow:auto;white-space:nowrap;width:100"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="co0">#!/bin/bash</span><br />
<span class="co0"># this script compiles a pdf version, an html version, and then copies it to my</span><br />
<span class="co0"># webserver</span><br />
<br />
<span class="co0"># compile as pdf</span><br />
pdflatex syllabus <span class="sy0">&amp;&amp;</span> pdflatex syllabus<br />
<br />
<span class="co0"># compile as html</span><br />
plastex &nbsp;<span class="re5">-c</span> syllabus.cfg syllabus<br />
<span class="co0"># clean up code a bit</span><br />
tidy <span class="re5">--show-body-only</span> <span class="kw2">true</span> <span class="re5">--ascii-chars</span> <span class="kw2">true</span> &nbsp;<span class="re5">-asxhtml</span> <span class="re5">--input-encoding</span> utf8 <span class="re5">--output-encoding</span> ascii <span class="re5">-wrap</span> <span class="nu0">0</span> <span class="re5">-indent</span> <span class="re5">--tab-size</span> <span class="nu0">4</span> syllabus<span class="sy0">/</span>index.html <span class="sy0">&gt;</span> syllabus<span class="sy0">/</span>syllabus.tmp<br />
<br />
<span class="co0"># add in link to pdf version in the html version</span><br />
<span class="kw2">cat</span> pdflink syllabus<span class="sy0">/</span>syllabus.tmp <span class="sy0">&gt;</span> syllabus<span class="sy0">/</span>syllabus.html<br />
<br />
<span class="co0"># update the syllabus page via xml-rpc</span><br />
.<span class="sy0">/</span>updateSyllabusPage.pl<br />
<br />
<span class="co0"># upload the newest version of the pdf</span><br />
rsync <span class="re5">-avzu</span> syllabus.pdf robfelty:<span class="sy0">/</span>var<span class="sy0">/</span>www<span class="sy0">/</span>html<span class="sy0">/</span>robfelty<span class="sy0">/</span>teaching<span class="sy0">/</span>ling5200Fall2009<span class="sy0">/</span>ling5200Fall2009-syllabus.pdf</div></div>
<h3>updateSyllabusPage.pl</h3>
<div class="codecolorer-container perl dawn" style="overflow:auto;white-space:nowrap;width:100"><div class="perl codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="co1">#!/usr/bin/perl -w</span><br />
<span class="kw2">use</span> WordPress<span class="sy0">::</span><span class="me2">API</span><span class="sy0">;</span><br />
<br />
<span class="co1"># get new syllabus content</span><br />
<span class="kw1">my</span> <span class="re0">$contentFile</span> <span class="sy0">=</span> <span class="st_h">'syllabus/syllabus.html'</span><span class="sy0">;</span><br />
<span class="kw3">open</span><span class="br0">&#40;</span>CONTENT<span class="sy0">,</span> <span class="re0">$contentFile</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<br />
<span class="co1"># slurp in content</span><br />
<span class="re0">$content</span> <span class="sy0">=</span> <span class="kw1">do</span> <span class="br0">&#123;</span><span class="kw3">local</span> <span class="br0">&#40;</span> <span class="co5">$/</span> <span class="br0">&#41;</span><span class="sy0">;</span> <span class="re4">&lt;CONTENT&gt;</span> <span class="br0">&#125;</span><span class="sy0">;</span><br />
<br />
<span class="kw1">my</span> <span class="re0">$w</span> <span class="sy0">=</span> WordPress<span class="sy0">::</span><span class="me2">API</span><span class="sy0">-&gt;</span><span class="me1">new</span><span class="br0">&#40;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp;proxy <span class="sy0">=&gt;</span> <span class="st_h">'http://robfelty/teaching/ling5200Fall2009/xmlrpc.php'</span><span class="sy0">,</span><br />
&nbsp; &nbsp;username <span class="sy0">=&gt;</span> <span class="st_h">'myusername'</span><span class="sy0">,</span><br />
&nbsp; &nbsp;password <span class="sy0">=&gt;</span> <span class="st_h">'mypassword'</span><span class="sy0">,</span><br />
<span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<br />
<span class="kw1">my</span> <span class="re0">$page</span> <span class="sy0">=</span> <span class="re0">$w</span><span class="sy0">-&gt;</span><span class="me1">page</span><span class="br0">&#40;</span><span class="nu0">3</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<br />
<span class="re0">$page</span><span class="sy0">-&gt;</span><span class="me1">description</span><span class="br0">&#40;</span><span class="re0">$content</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="re0">$page</span><span class="sy0">-&gt;</span><span class="me1">save</span><span class="sy0">;</span></div></div>
<p>Finally, if you want to see how I customize content for pdf and html separately, you can check out <a href='http://robfelty/subversion/ling5200/syllabus/syllabus.tex'>the LaTeX source file</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.robfelty.com/2009/08/18/blogging-with-latex/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Postie 1.3.0 released</title>
		<link>http://blog.robfelty.com/2009/08/14/postie-1-3-0-released/</link>
		<comments>http://blog.robfelty.com/2009/08/14/postie-1-3-0-released/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 18:10:59 +0000</pubDate>
		<dc:creator>robfelty</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[postie]]></category>

		<guid isPermaLink="false">http://blog.robfelty.com/?p=397</guid>
		<description><![CDATA[After more than a month of fixing bugs and adding features, I have decided it is time to release Postie 1.3.0, the wordpress plugin which adds many features to post to your blog via e-mail. 1.3 offers many new features over the 1.2 line of postie, including better attachment handling, better language and character set [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.robfelty.com/wp-content/uploads/2009/08/postie_200x200_7.png"><img src="http://blog.robfelty.com/wp-content/uploads/2009/08/postie_200x200_7.png" alt="postie_200x200_7" title="postie_200x200_7" width="200" height="200" class="alignright size-full wp-image-398" /></a>After more than a month of fixing bugs and adding features, I have decided it is time to release <a href='http://wordpress.org/extend/plugins/postie'>Postie</a> 1.3.0, the wordpress plugin which adds many features to post to your blog via e-mail. 1.3 offers many new features over the 1.2 line of postie, including better attachment handling, better language and character set support, and easier configuration. Here is a list of the new features and bug fixes from 1.3.beta to 1.3.0.</p>
<ul>
<li> Features
<ul>
<li> Added mpeg4 to default list of videotypes</li>
<li> Added support for KOI8-R character set (cyrillic)</li>
<li> Added support for iso-8859-2 character set (eastern european)</li>
<li> Added option to include custom icons for attachments</li>
<li> Added option to send confirmation message to sender</li>
<li> Enhanced e-mails for unauthorized users</li>
<li> Added option to send unauthorized e-mail back to sender</li>
<li> Added option to only allow e-mails from a specified list of smtp</li>
<p>      servers</li>
<li> Added option to use shortcode for embedding videos (works with the</li>
<p>      videos plugin http://www.daburna.de/download/videos-plugin.zip</li>
<li> Better handling of comment authors (thanks to Petter for suggestion)</li>
<li> Simplified message options (now includes an advanced options section)</li>
<li> Added filter ability for post content</li>
</li>
</ul>
<li> Bug fixes
<ul>
<li> No longer including wp-config.php</li>
<li> If tmpdir is not writable, try a different tmpdir</li>
<li> More subject encoding fixes</li>
<li> Updated image templates, which were causing problems for cron</li>
<li> Fixed in text captions</li>
<li> Fixed SQL problems when updating options</li>
<li> Fixed name clashes with other plugins</li>
<li> Fixed custom image field</li>
</ul>
</li>
</ul>
<p>I want to thank the many users who were willing to test out new features and bug fixes by trying out the development version. in particular, I want to thank Kyle and Hab at <a href='http://acu.edu'>Abilene Christian University</a> for offering me financial support to develop some additional features for their use of postie for a course at their university. I think that other postie users will enjoy some of these new features as well. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.robfelty.com/2009/08/14/postie-1-3-0-released/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:thumbnail url="http://blog.robfelty.com/wp-content/uploads/2009/08/postie_200x200_7.png" />
		<media:content url="http://blog.robfelty.com/wp-content/uploads/2009/08/postie_200x200_7.png" medium="image">
			<media:title type="html">postie_200x200_7</media:title>
		</media:content>
	</item>
		<item>
		<title>On blog navigation</title>
		<link>http://blog.robfelty.com/2009/07/24/on-blog-navigation/</link>
		<comments>http://blog.robfelty.com/2009/07/24/on-blog-navigation/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 04:20:25 +0000</pubDate>
		<dc:creator>robfelty</dc:creator>
				<category><![CDATA[(x)html]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[navigation]]></category>
		<category><![CDATA[seo]]></category>

		<guid isPermaLink="false">http://blog.robfelty.com/?p=383</guid>
		<description><![CDATA[I was recently debating with my friend Danny how people navigate sites, especially blogs. As the author of 3 plugins designed to enhance site navigation (collapsing archives, categories, and pages), I of course had my opinions, but what is really compelling is data. So I finally decided to modify my links on my site a [...]]]></description>
			<content:encoded><![CDATA[<p><div id="attachment_384" class="wp-caption alignright" style="width: 260px"><a href="http://blog.robfelty.com/wp-content/uploads/2009/07/navigation.png"><img src="http://blog.robfelty.com/wp-content/uploads/2009/07/navigation-250x289.png" alt="A few navigation choices after reading an article on a blog" title="navigation" width="250" height="289" class="size-medium wp-image-384" /></a><p class="wp-caption-text">A few navigation choices after reading an article on a blog</p></div> I was recently debating with my friend Danny how people navigate sites, especially blogs. As the author of 3 plugins designed to enhance site navigation (collapsing archives, categories, and pages), I of course had my opinions, but what is really compelling is data. So I finally decided to modify my links on my site a bit in order to figure out more exactly how people are navigating my site. There are several different ways in which people can navigate to a particular page on my site. </p>
<ul>
<li>external
<ul>
<li>search</li>
<li>social network (digg, reddit, friendfeed, etc.)</li>
</ul>
</li>
<li>internal
<ul>
<li>collapsing archives widget</li>
<li>collpsing categorries widget</li>
<li>collapsing pages widget</li>
<li>category page</li>
<li>archive page</li>
<li>search</li>
<li>index page link</li>
<li>prev page link</li>
<li>next page link</li>
</ul>
</li>
</ul>
<p>I added a ?nav query to each of these particular options, so that I could then find those values in the server logs. I wrote a little bash script which mostly does some grepping of the log. Here is the script, and the results for the last 12 hours or so. My plan is to collect about 30 days worth of data, and see what the data shows. I think the results will be informative.</p>
<div class="codecolorer-container bash dawn" style="overflow:auto;white-space:nowrap;width:100;height:300px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="co0">#!/bin/bash</span><br />
<span class="co0"># calculate how people navigate my site</span><br />
<br />
<span class="co0"># first we filter out all spiders, any internal blog stuff, and requests from</span><br />
<span class="co0"># my own ip, and then pipe that to filter out page refreshes</span><br />
<span class="kw2">grep</span> <span class="re5">-vEi</span> <span class="st_h">'(Mediapartners-Google|bot|spider|crawler|slurp|scoutjet|httpunit|htmlparser|favicon|wp-cron.php|wp-content|wp-photos|wp-comments|feed|fail\.php|wp-login.php|POST|\/images|wp-includes|forum|71\.237\.102\.16)'</span> experiment_log <span class="sy0">|</span><span class="kw2">grep</span> <span class="re5">-Ev</span> <span class="st_h">'&quot;GET (.*) .*\1'</span> <span class="sy0">&gt;</span> nobots<br />
<br />
<span class="co0"># next we separate into internal and external referers</span><br />
<span class="kw2">grep</span> <span class="st_h">'http://blog.robfelty.com'</span> nobots <span class="sy0">&gt;</span> INTERNAL<br />
<span class="kw2">grep</span> <span class="re5">-v</span> <span class="st_h">'http://blog.robfelty.com'</span> nobots <span class="sy0">&gt;</span> EXTERNAL<br />
<br />
<span class="re2">EXTSEARCH</span>=<span class="sy0">`</span><span class="kw2">grep</span> <span class="re5">-ciE</span> <span class="st_h">'(yahoo|bing|google)'</span> EXTERNAL<span class="sy0">`</span><br />
<span class="re2">SOCIAL</span>=<span class="sy0">`</span><span class="kw2">grep</span> <span class="re5">-ciE</span> <span class="st_h">'(fark|reddit|digg|slashdot|friendfeed|facebook|twitter)'</span> EXTERNAL<span class="sy0">`</span><br />
<span class="re2">NOREFERER</span>=<span class="sy0">`</span><span class="kw2">grep</span> <span class="re5">-c</span> <span class="st_h">'&quot;-&quot;'</span> EXTERNAL<span class="sy0">`</span><br />
<span class="re2">EXTREMAINING</span>=<span class="sy0">`</span><span class="kw2">grep</span> <span class="re5">-viE</span> <span class="st_h">'(yahoo|bing|google|fark|reddit|digg|slashdot|friendfeed|facebook|twitter)'</span> EXTERNAL<span class="sy0">|</span><span class="kw2">grep</span> <span class="re5">-cv</span> <span class="st_h">'&quot;-&quot;'</span><span class="sy0">`</span><br />
<span class="re2">COLLARCH</span>=<span class="sy0">`</span><span class="kw2">grep</span> <span class="re5">-c</span> <span class="st_h">'?nav=collapsing-archives'</span> INTERNAL<span class="sy0">`</span><br />
<span class="re2">COLLCAT</span>=<span class="sy0">`</span><span class="kw2">grep</span> <span class="re5">-c</span> <span class="st_h">'?nav=collapsing-category'</span> INTERNAL<span class="sy0">`</span><br />
<span class="re2">YEARLY</span>=<span class="sy0">`</span><span class="kw2">grep</span> <span class="re5">-c</span> <span class="st_h">'?nav=yearly'</span> INTERNAL<span class="sy0">`</span><br />
<span class="re2">MONTHLY</span>=<span class="sy0">`</span><span class="kw2">grep</span> <span class="re5">-c</span> <span class="st_h">'?nav=monthly'</span> INTERNAL<span class="sy0">`</span><br />
<span class="re2">CAT</span>=<span class="sy0">`</span><span class="kw2">grep</span> <span class="re5">-c</span> <span class="st_h">'?nav=category'</span> INTERNAL<span class="sy0">`</span><br />
<span class="re2">COLLPAGE</span>=<span class="sy0">`</span><span class="kw2">grep</span> <span class="re5">-c</span> <span class="st_h">'?nav=collapsing-pages'</span> INTERNAL<span class="sy0">`</span><br />
<span class="re2">SEARCH</span>=<span class="sy0">`</span><span class="kw2">grep</span> <span class="re5">-c</span> <span class="st_h">'?nav=search'</span> INTERNAL<span class="sy0">`</span><br />
<span class="re2">INDEX</span>=<span class="sy0">`</span><span class="kw2">grep</span> <span class="re5">-c</span> <span class="st_h">'?nav=index'</span> INTERNAL<span class="sy0">`</span><br />
<span class="re2">PREV</span>=<span class="sy0">`</span><span class="kw2">grep</span> <span class="re5">-c</span> <span class="st_h">'?nav=previous'</span> INTERNAL<span class="sy0">`</span><br />
<span class="re2">NEXT</span>=<span class="sy0">`</span><span class="kw2">grep</span> <span class="re5">-c</span> <span class="st_h">'?nav=next'</span> INTERNAL<span class="sy0">`</span><br />
<span class="re2">TOTAL</span>=<span class="sy0">`</span><span class="kw2">wc</span> <span class="re5">-l</span> nobots<span class="sy0">|</span><span class="kw2">cut</span> <span class="re5">-f1</span> <span class="re5">-d</span> <span class="st_h">' '</span><span class="sy0">`</span><br />
<span class="re2">INTERNAL</span>=<span class="sy0">`</span><span class="kw2">wc</span> <span class="re5">-l</span> INTERNAL<span class="sy0">|</span><span class="kw2">cut</span> <span class="re5">-f1</span> <span class="re5">-d</span> <span class="st_h">' '</span><span class="sy0">`</span><br />
<span class="re2">EXTERNAL</span>=<span class="sy0">`</span><span class="kw2">wc</span> <span class="re5">-l</span> EXTERNAL<span class="sy0">|</span><span class="kw2">cut</span> <span class="re5">-f1</span> <span class="re5">-d</span> <span class="st_h">' '</span><span class="sy0">`</span><br />
<span class="co0"># Only firefox prefetches</span><br />
<span class="re2">PREFETCH</span>=<span class="sy0">`</span><span class="kw2">grep</span> <span class="re5">-vE</span> <span class="st_h">'\?nav=(collapsing-category|collapsing-archives|search|index|previous|next)'</span> INTERNAL<span class="sy0">|</span><span class="kw2">grep</span> <span class="re5">-c</span> <span class="st_h">'Firefox'</span><span class="sy0">`</span><br />
<span class="re2">INTREMAINING</span>=<span class="sy0">`</span><span class="kw2">grep</span> <span class="re5">-vE</span> <span class="st_h">'\?nav=(collapsing-category|collapsing-archives|search|index|previous|next)'</span> INTERNAL<span class="sy0">|</span><span class="kw2">grep</span> <span class="re5">-cv</span> <span class="st_h">'Firefox'</span><span class="sy0">`</span><br />
<span class="kw3">echo</span> <span class="st0">&quot;TOTAL PAGES = <span class="es2">$TOTAL</span>&quot;</span><br />
<span class="kw3">echo</span> <span class="st0">&quot; &nbsp;EXTERNAL= <span class="es2">$EXTERNAL</span>&quot;</span><br />
<span class="kw3">echo</span> <span class="st0">&quot; &nbsp; &nbsp;EXTSEARCH = <span class="es2">$EXTSEARCH</span>&quot;</span><br />
<span class="kw3">echo</span> <span class="st0">&quot; &nbsp; &nbsp;SOCIAL = <span class="es2">$SOCIAL</span>&quot;</span><br />
<span class="kw3">echo</span> <span class="st0">&quot; &nbsp; &nbsp;NOREFERER = <span class="es2">$NOREFERER</span>&quot;</span><br />
<span class="kw3">echo</span> <span class="st0">&quot; &nbsp; &nbsp;REMAINING = <span class="es2">$EXTREMAINING</span>&quot;</span><br />
<span class="kw3">echo</span> <span class="st0">&quot; &nbsp;INTERNAL= <span class="es2">$INTERNAL</span>&quot;</span><br />
<span class="kw3">echo</span> <span class="st0">&quot; &nbsp; &nbsp;COLLARCH = <span class="es2">$COLLARCH</span>&quot;</span><br />
<span class="kw3">echo</span> <span class="st0">&quot; &nbsp; &nbsp;YEARLY = <span class="es2">$YEARLY</span>&quot;</span><br />
<span class="kw3">echo</span> <span class="st0">&quot; &nbsp; &nbsp;MONTHLY = <span class="es2">$MONTHLY</span>&quot;</span><br />
<span class="kw3">echo</span> <span class="st0">&quot; &nbsp; &nbsp;COLLCAT = <span class="es2">$COLLCAT</span>&quot;</span><br />
<span class="kw3">echo</span> <span class="st0">&quot; &nbsp; &nbsp;CAT = <span class="es2">$CAT</span>&quot;</span><br />
<span class="kw3">echo</span> <span class="st0">&quot; &nbsp; &nbsp;COLLPAGE = <span class="es2">$COLLPAGE</span>&quot;</span><br />
<span class="kw3">echo</span> <span class="st0">&quot; &nbsp; &nbsp;SEARCH = <span class="es2">$SEARCH</span>&quot;</span><br />
<span class="kw3">echo</span> <span class="st0">&quot; &nbsp; &nbsp;INDEX = <span class="es2">$INDEX</span>&quot;</span><br />
<span class="kw3">echo</span> <span class="st0">&quot; &nbsp; &nbsp;PREV = <span class="es2">$PREV</span>&quot;</span><br />
<span class="kw3">echo</span> <span class="st0">&quot; &nbsp; &nbsp;NEXT = <span class="es2">$NEXT</span>&quot;</span><br />
<span class="kw3">echo</span> <span class="st0">&quot; &nbsp; &nbsp;PREFETCH = <span class="es2">$PREFETCH</span>&quot;</span><br />
<span class="kw3">echo</span> <span class="st0">&quot; &nbsp; &nbsp;REMAINING = <span class="es2">$INTREMAINING</span>&quot;</span></div></div>
<pre>
TOTAL PAGES = 197
  EXTERNAL= 131
    EXTSEARCH = 51
    SOCIAL = 0
    NOREFERER = 43
    REMAINING = 37
  INTERNAL= 66
    COLLARCH = 3
    YEARLY = 0
    MONTHLY = 0
    COLLCAT = 4
    CAT = 0
    COLLPAGE = 0
    SEARCH = 1
    INDEX = 1
    PREV = 0
    NEXT = 0
    PREFETCH = 52
    REMAINING = 5
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.robfelty.com/2009/07/24/on-blog-navigation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:thumbnail url="http://blog.robfelty.com/wp-content/uploads/2009/07/navigation-250x289.png" />
		<media:content url="http://blog.robfelty.com/wp-content/uploads/2009/07/navigation-250x289.png" medium="image">
			<media:title type="html">navigation</media:title>
		</media:content>
	</item>
		<item>
		<title>BBpress forums and wordpress plugin development versions</title>
		<link>http://blog.robfelty.com/2009/07/08/bbpress-forums-and-wordpress-plugin-development-versions/</link>
		<comments>http://blog.robfelty.com/2009/07/08/bbpress-forums-and-wordpress-plugin-development-versions/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 19:40:12 +0000</pubDate>
		<dc:creator>robfelty</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[bbpress]]></category>

		<guid isPermaLink="false">http://blog.robfelty.com/?p=369</guid>
		<description><![CDATA[I host a bbpress forum for each of my wordpress plugins, so that people can report bugs and ask for new features. Bbpress has many of the same features as wordpress, and it integrates very well with wordpress. It is also very fast, and as of version 1.0, now has the same admin interface as [...]]]></description>
			<content:encoded><![CDATA[<p><div id="attachment_370" class="wp-caption alignnone" style="width: 610px"><a href="http://blog.robfelty.com/wp-content/uploads/2009/07/development.png"><img src="http://blog.robfelty.com/wp-content/uploads/2009/07/development-600x312.png" alt="Gentle reminders for forum users" title="Gentle reminders for forum users" width="600" height="312" class="size-large wp-image-370" /></a><p class="wp-caption-text">Gentle reminders for forum users</p></div><br />
I host a bbpress forum for each of my wordpress plugins, so that people can report bugs and ask for new features. Bbpress has many of the same features as wordpress, and it integrates very well with wordpress. It is also very fast, and as of version 1.0, now has the same admin interface as wordpress. </p>
<p>When people report bugs on the forum, I frequently try to fix them in the development version of the plugin, and ask them to test it, which requires downloading the development version from the wordpress.org site. Unfortunately, the development version is a bit hidden there, and I have gotten very tired of typing out the url in my replies, so I finally modified the topic.php file in my bbpress template to include a link to the development version (and a link to the faq too). </p>
<p>One downside of bbpress is that there is no documentation yet, so you have to search around for different functions in the code. I have done this several times now, so that it only took me about 20 minutes to figure out how to implement what I wanted. Here is the code I added (just before <tt>post_form()</tt>)</p>
<div class="codecolorer-container php dawn" style="overflow:auto;white-space:nowrap;width:100"><div class="php codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="kw2">&lt;?php</span> <br />
<span class="re0">$thisforum</span><span class="sy0">=</span> bb_get_forum<span class="br0">&#40;</span>get_forum_id<span class="br0">&#40;</span><span class="nu0">0</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; <span class="re0">$development</span><span class="sy0">=</span><span class="st_h">'http://wordpress.org/extend/plugins/'</span> <span class="sy0">.</span> <span class="re0">$thisforum</span><span class="sy0">-&gt;</span><span class="me1">forum_slug</span> <span class="sy0">.</span><br />
&nbsp; &nbsp; &nbsp; <span class="st_h">'/download'</span><span class="sy0">;</span><br />
&nbsp; <span class="re0">$faq</span><span class="sy0">=</span><span class="st_h">'http://wordpress.org/extend/plugins/'</span> <span class="sy0">.</span> <span class="re0">$thisforum</span><span class="sy0">-&gt;</span><span class="me1">forum_slug</span> <span class="sy0">.</span><br />
&nbsp; &nbsp; &nbsp; <span class="st_h">'/faq'</span><span class="sy0">;</span><br />
<span class="sy1">?&gt;</span><br />
&nbsp; &lt;div class='alert'&gt;<br />
&nbsp; Have you read the &lt;a href='<span class="kw2">&lt;?php</span> <span class="kw3">echo</span> <span class="re0">$faq</span><span class="sy0">;</span> <span class="sy1">?&gt;</span>'&gt;FAQ&lt;/a&gt;?&lt;br /&gt;<br />
&nbsp; Have you tried the latest &lt;a href='<span class="kw2">&lt;?php</span> <span class="kw3">echo</span> <span class="re0">$development</span><span class="sy0">;</span> <span class="sy1">?&gt;</span>'&gt;development version&lt;/a&gt; (at the bottom)?<br />
&nbsp; &lt;/div&gt;</div></div>
<p>I then added the following css to my theme to make it stand out:</p>
<div class="codecolorer-container css dawn" style="overflow:auto;white-space:nowrap;width:100"><div class="css codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="re1">.alert</span> <span class="br0">&#123;</span><span class="kw1">border</span><span class="sy0">:</span><span class="re3">1px</span> <span class="kw2">solid</span> <span class="re0">#999</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">background-color</span><span class="sy0">:</span> <span class="re0">#FBB</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">font-size</span><span class="sy0">:</span>1.1.em<span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">padding</span><span class="sy0">:</span><span class="re3">.2em</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#125;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.robfelty.com/2009/07/08/bbpress-forums-and-wordpress-plugin-development-versions/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:thumbnail url="http://blog.robfelty.com/wp-content/uploads/2009/07/development-600x312.png" />
		<media:content url="http://blog.robfelty.com/wp-content/uploads/2009/07/development-600x312.png" medium="image">
			<media:title type="html">Gentle reminders for forum users</media:title>
		</media:content>
	</item>
	</channel>
</rss>
