<?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>Archetyped</title>
	<atom:link href="http://archetyped.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://archetyped.com</link>
	<description>Explore, Experiment, Inspire</description>
	<lastBuildDate>Thu, 26 Aug 2010 23:55:06 +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>Lab &#8250; Cornerstone: Now is the Time for Action (and Filters)</title>
		<link>http://archetyped.com/lab/cornerstone-now-is-the-time-for-action-and-filters/</link>
		<comments>http://archetyped.com/lab/cornerstone-now-is-the-time-for-action-and-filters/#comments</comments>
		<pubDate>Wed, 25 Aug 2010 21:47:21 +0000</pubDate>
		<dc:creator>Sol</dc:creator>
				<category><![CDATA[Feature]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Cornerstone]]></category>
		<category><![CDATA[Dev]]></category>
		<category><![CDATA[Hooks]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://archetyped.com/?p=624</guid>
		<description><![CDATA[<p><em>Content Types finally get some action</em></p>Cornerstone's content types now have the ability to hook into Wordpress with actions and filters, making it easy to fully customize how post fields are retrieved, displayed, and saved.]]></description>
			<content:encoded><![CDATA[<p><em>Content Types finally get some action</em></p><p><a href="http://archetyped.com/tools/cornerstone/" title="Cornerstone">Cornerstone&#8217;s</a> content types now have the ability to hook into WordPress with <a href="http://codex.wordpress.org/Plugin_API/Action_Reference" target="_blank">actions</a> and <a href="http://codex.wordpress.org/Plugin_API/Filter_Reference" target="_blank">filters</a>, making it easy to fully customize how post fields are retrieved, displayed, and saved.</p>
<h3>Background</h3>
<p>With the release of <a href="http://wordpress.org/news/2004/05/heres-the-beef/" target="_blank">WordPress 1.2</a>, customizing WordPress has been greatly simplified by the inclusion of a <a href="http://codex.wordpress.org/Plugin_API" target="_blank">plugin API</a>.  This API is comprised of <strong>actions</strong> and <strong>filters</strong> that provide specific points in WordPress for plugins to &#8220;hook&#8221; into and customize how WordPress functions.  This makes WordPress an incredibly flexible platform for any type of project ranging from simple blogs to complex web applications.</p>
<p>Similarly, Cornerstone&#8217;s content types are like <em>mini plugins</em> that customize <strong>posts</strong> for a particular use or purpose. Thus, content types would also benefit greatly from the ability to hook into WordPress&#8217; actions and filters.</p>
<h3>Explore</h3>
<p>I openly admit that while I had this on my to-do list for a while, I was actually <em>tricked</em> into implementing this functionality into Cornerstone when I wanted to create a rich text (aka <a href="http://wikipedia.org/wiki/WYSIWYG" target="_blank">WYSIWYG</a>) field for use in content types.  This would make it simpler to format content in text fields, since the standard <code>textarea</code> field is simply plain text (no formatting).</p>
<p>Since WordPress uses <a href="http://tinymce.moxiecode.com/" target="_blank">TinyMCE</a> as its rich text editor by default, it was a logical choice for Cornerstone&#8217;s <code>richtext</code> field, so I did some exploratory work to determine how TinyMCE is implemented in WordPress itself.</p>
<p>As I said, I was <em>tricked</em> into enabling actions and filters for content types.  When I started looking into using TinyMCE in a field, I assumed that it would require adding Javascript to a page (since this is how TinyMCE is implemented by default), which Cornerstone&#8217;s content types can already do:</p>
<pre class="brush:php;gutter:false">$field-&gt;add_script($context, $handle, $uri, $dependencies);</pre>
<p>However, WordPress uses an action to call a function that handles all of the configuration and Javascript loading separately:</p>
<pre class="brush:php;gutter:false">add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 25 );</pre>
<p>I was already committed.  Cornerstone&#8217;s content types would need to have access to actions and filters.</p>
<h3>Experiment</h3>
<p>There were a couple of questions that needed to be answered before hooks would be enabled in Cornerstone.</p>
<h4>1. Which content types to register hooks for?</h4>
<p>During initialization, all content types are registered so that WordPress has access to them.  However, not all content types are used in every request, so it would not be a good idea to register the hooks for <em>all</em> content types, but rather only the ones that are used in the current request.  Therefore, the first step is to determine which content types are used in the current request.</p>
<h4>2. When to register hooks for content types?</h4>
<p>Once we&#8217;ve determined which content types are currently in use, we can register the hooks for them.  The issue here is that we need to <em>use</em> a hook to register the hooks for the content types, so we&#8217;ve already lost one potential hook for content types to use.  We also need to make sure that WordPress is far enough along in its initialization process to be able to accept a content type&#8217;s hooks (i.e. environmental variables set, default post types registered, etc.), which may remove yet more hooks from those that content types can use.</p>
<p>After a bit of research and testing, the optimal hook to use for registering actions and filters for content types was <code>init</code>:</p>
<pre class="brush:php;gutter:false">add_action('init', 'add_hooks', 11);</pre>
<p>This means that the <code>init</code> action and any hook that precedes it will not be available for content types.  I&#8217;m not particularly fond of this limitation, but it is mitigated by the fact that there are only a few hooks before <code>init</code> and the vast majority of content types will use hooks that come <em>after</em> <code>init</code>.  Nonetheless, I would be happier if <code>init</code> were available to content types (since it&#8217;s a pretty common hook), so I&#8217;m still looking at some options for bringing it back into the fold.</p>
<p>In the end, enabling action and filter hooks for Cornerstone&#8217;s content types was not as involved as I imagined it would be (hence why it sat on my to-do list for as long as it did), and the ability to hook into WordPress with content types was well worth the time and effort.</p>
<h3>Payoff</h3>
<p>The payoff for the work is that hooking to WordPress is as simple as this:</p>
<pre class="brush:php;gutter:false">$richtext-&gt;add_action('admin_print_footer_scripts', 'wp_tiny_mce', 25);</pre>
<p>Even better is that the possibilities are now endless.  Just as with plugins, it&#8217;s really now down to our imagination to use Cornerstone&#8217;s content types to customize WordPress to the needs of our projects.</p>
<p><a href="http://archetyped.com/lab/cornerstone-now-is-the-time-for-action-and-filters/"> Cornerstone: Now is the Time for Action (and Filters)</a> was originally published on <a href="http://archetyped.com">Archetyped</a> on August 25, 2010 11:47am</p>]]></content:encoded>
			<wfw:commentRss>http://archetyped.com/lab/cornerstone-now-is-the-time-for-action-and-filters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lab &#8250; Cornerstone: Structure Now More Structured</title>
		<link>http://archetyped.com/lab/cornerstone-structure-now-more-structured/</link>
		<comments>http://archetyped.com/lab/cornerstone-structure-now-more-structured/#comments</comments>
		<pubDate>Sat, 21 Aug 2010 04:03:47 +0000</pubDate>
		<dc:creator>Sol</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Bug]]></category>
		<category><![CDATA[Cornerstone]]></category>
		<category><![CDATA[Dev]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://archetyped.com/?p=619</guid>
		<description><![CDATA[Wordpress has a nice little UI element below the post title field that updates to show you the post's permalink after you have entered a title for the post.  This permalink preview is useful because it provides the user with feedback on the post they are in the process of writing.   It's also great because it showed me that Cornerstone had a little bug.]]></description>
			<content:encoded><![CDATA[<p>WordPress has a nice little UI element below the post title field that  updates to show you the post&#8217;s permalink after you have entered a title  for the post.  This permalink preview is useful because it provides the  user with feedback on the post they are in the process of writing.    It&#8217;s also great because it showed me that <a href="http://archetyped.com/tools/cornerstone/" title="Cornerstone">Cornerstone</a> had a little bug.</p>
<p>The other day, I fired up WordPress to write a new post, added the title, and started to write the post&#8217;s content, when I noticed something strange was going on with the permalink preview:</p>
<div id="attachment_622" class="wp-caption alignnone" style="width: 449px"><img class="size-full wp-image-622" title="Permalink Bugg" src="http://archetyped.com/wp-content/uploads/cnr_bug_permalink.gif" alt="" width="439" height="147" /><p class="wp-caption-text">Oops</p></div>
<h3>The Bug</h3>
<p>One of Cornerstone&#8217;s main features is <strong>Structure</strong>.  Structure allows a site to have sections and for authors to add posts to any of these sections.  When a post is added to a section, Structure makes sure the post&#8217;s permalink is logically connected to the section&#8217;s permalink.</p>
<ul>
<li>Section: <code>http://site-name.com/section-name/</code></li>
<li>Post: <code>http://site-name.com/section-name/post-name/</code></li>
</ul>
<p>Cornerstone adds a new permalink structure to <strong>Settings &gt; Permalinks</strong> in the site&#8217;s admin area which lets users enable this type of logical connection between posts and sections.</p>
<ul>
<li>Structured: <code>/%postpath%/%postname%/</code></li>
</ul>
<p>On this particular occasion, I had not yet selected a section for the post, which is was fortuitous because it revealed that Structure&#8217;s permalink modification was not working quite right for drafts.  In truth, it was not working <em>at all</em> because Structure was disabled for drafts.</p>
<pre class="brush:php">function post_link($permalink, $post, $leavename = false) {
	global $wp_query;
	if ( !$this-&gt;using_post_permastruct()
		|| ( !$this-&gt;util-&gt;check_post($post) )
		|| !$this-&gt;util-&gt;property_exists($post, 'post_name')
		|| empty($post-&gt;post_name)
		|| !$this-&gt;util-&gt;property_exists($post, 'post_parent')
		|| 0 == $post-&gt;post_parent )
		return $permalink;

//	...continue modifying permalink...</pre>
<p>According to this code, the custom permalink structure will not be used if any of the following conditions are met:</p>
<ul>
<li>Cornerstone&#8217;s custom permalink structure is not enabled</li>
<li>Valid post not passed to function</li>
<li>Post has no name (e.g. drafts)</li>
<li>Post is not in a section</li>
</ul>
<p>Since the function stopped before making any modifications to the draft post&#8217;s permalink, the permalink generated by WordPress remained.  However, since Cornerstone&#8217;s permalink structure contains a custom <a href="http://codex.wordpress.org/Using_Permalinks#Structure_Tags" target="_blank">structure tag</a> (<code>%postpath%</code>), WordPress did not know what to do with it and simply left it in the permalink (only replacing the standard <code>%postname%</code> tag).</p>
<p>Posts without sections are simply supposed to be located at the site&#8217;s root level (e.g. <code>http://site-name.com/post-name/</code>), but the conditions that were set to determine whether a post&#8217;s permalink should be modified were overly aggressive.  The result was that any post that wasn&#8217;t in a section would have an invalid permalink.</p>
<h3>The Fix</h3>
<p>Thankfully, the solution to this issue was quite apparent&#8211; simplify!</p>
<pre class="brush:php">function post_link($permalink, $post, $leavename = false) {
	global $wp_query, $cnr_content_utilities;

	if ( !$this-&gt;using_post_permastruct()
		|| ( !$this-&gt;util-&gt;check_post($post) )
		|| ( empty($post-&gt;post_name) &amp;&amp; empty($post-&gt;post_title) ) )
		return $permalink;

//	...continue modifying post permalink...</pre>
<p>Now the custom permalink structure would be used for a post except under just a few conditions:</p>
<ul>
<li> Custom permalink structure is not activated by user</li>
<li>Valid post not passed to function</li>
<li> Post has no name <em>or </em>title (e.g. drafts)</li>
</ul>
<p>We check for the existence of the post&#8217;s title if there is no post name (i.e. the post&#8217;s slug) because in certain instances, the post passed to this function may not yet have a slug, but it will have a title (which we can still work with).  Only if the post has neither slug nor title will we halt further processing (since we can&#8217;t build a full permalink without at least one of those values).</p>
<p>Finally, since custom post types made their full debut in WordPress 3.0, we need a small addition to support them as well.  Cornerstone allows putting items with custom post types into sections as well, so the same permalink structure is used for items that have a section selected (i.e. <code>/section-name/post-name/</code>).  However, by default, the permalink structure for items with custom content types is <code>/post-type/post-name/</code>, so if an item is <em>not</em> in a section and it has a custom post type, then the default permalink structure should be used.</p>
<p>So our final conditional statement looks like:</p>
<pre class="brush:php">function post_link($permalink, $post, $leavename = false) {
	global $wp_query, $cnr_content_utilities;

	if ( !$this-&gt;using_post_permastruct()
		|| ( !$this-&gt;util-&gt;check_post($post) )
		|| ( empty($post-&gt;post_name) &amp;&amp; empty($post-&gt;post_title) )
		|| ( !$cnr_content_utilities-&gt;is_default_post_type($post-&gt;post_type) &amp;&amp; empty($post-&gt;post_parent) ) )
		return $permalink;

//	...continue modifying post permalink...</pre>
<p>Now post permalinks work just fine and <a href="http://archetyped.com/tools/cornerstone/" title="Cornerstone">Cornerstone&#8217;s</a> <strong>Structure</strong> is even more structured than before.</p>
<p><a href="http://archetyped.com/lab/cornerstone-structure-now-more-structured/"> Cornerstone: Structure Now More Structured</a> was originally published on <a href="http://archetyped.com">Archetyped</a> on August 20, 2010 06:03pm</p>]]></content:encoded>
			<wfw:commentRss>http://archetyped.com/lab/cornerstone-structure-now-more-structured/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lab &#8250; Favicon Rotator 1.1: Optimized Icons</title>
		<link>http://archetyped.com/lab/favicon-rotator-1-1-optimized-icons/</link>
		<comments>http://archetyped.com/lab/favicon-rotator-1-1-optimized-icons/#comments</comments>
		<pubDate>Sat, 21 Aug 2010 00:10:00 +0000</pubDate>
		<dc:creator>Sol</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Dev]]></category>
		<category><![CDATA[Favicon]]></category>
		<category><![CDATA[Favicon Rotator]]></category>
		<category><![CDATA[Icon]]></category>
		<category><![CDATA[Image]]></category>
		<category><![CDATA[Optimization]]></category>
		<category><![CDATA[Update]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://archetyped.com/?p=617</guid>
		<description><![CDATA[Favicon Rotator received a few updates recently, but the main highlight is that optimized icons are now created for uploaded images.]]></description>
			<content:encoded><![CDATA[<p><a href="http://archetyped.com/tools/favicon-rotator/" title="Favicon Rotator">Favicon Rotator</a> received a few updates recently, but the main highlight is that optimized icons are now created for uploaded images.</p>
<h3>Why?</h3>
<p>The primary purpose of Favicon Rotator was to make it simple to upload a favicon for a WordPress site.  So in version 1.0, the plugin basically loaded the image as it was uploaded by the user.  This works perfectly fine, especially if the user uploads an image <em>meant</em> to be a favicon (i.e. 16&#215;16 resolution).  Larger images were properly loaded as well, but it was left up to the browser to resize the image to fit in the 16&#215;16 space in the browser&#8217;s address bar.  The other issue was that if the user selected a large image to use as a favicon, then the site&#8217;s loading time could be increased since the entire image needed to be downloaded (regardless of how small it was being displayed).</p>
<p>I definitely am not a fan of slower loading, but I was initially hesitant to create additional files since WordPress already automatically creates thumbnail files for all uploaded images, which is a waste of disk space if the user will never use them.  However, due to the potential for increased load times and the hit-or-miss results when letting the browser resize large images, I decided that Favicon Rotator should create an image optimized for use as a favicon.</p>
<p>Thankfully, WordPress is not stupid (quite smart in fact), and it will not create additional intermediate files (thumbnails, etc.) if the original image is smaller than the intermediate sizes.  This means that if a user does upload a 16&#215;16 image file that is already optimized for use as a favicon, no additional files will be created.  Therefore, only images that would benefit from an intermediate file will have one created.</p>
<h3>When?</h3>
<p>Favicon Rotator doesn&#8217;t create favicon-sized files for <em>all </em>images uploaded to WordPress, but rather only when certain criteria are met:</p>
<ul>
<li>Images that are uploaded via Favicon Rotator&#8217;s admin page</li>
<li>Images that were uploaded by other means, but are selected for use as a favicon</li>
</ul>
<p>This minimizes the number of extraneous files in WordPress since optimized icons are created on-demand and saved for future use (so icons for an image are only created once).</p>
<h3>How?</h3>
<p>Adding a new intermediate size for uploaded images is very simple.  It only takes one quick line of code:</p>
<pre class="brush:php;gutter:false">add_image_size($image_size, $width, $height, $crop);</pre>
<p>Then, you simply add a hook to register this new size once WordPress has loaded.  Basically any hook including and beyond <code>init</code> will do, but I chose to hook into <code>intermediate_image_sizes</code> so that the favicon image size is added only when the available intermediate image sizes are requested (otherwise the favicon image size would be added during every request whether it was needed or not).</p>
<pre class="brush:php;gutter:false">add_filter('intermediate_image_sizes', 'add_intermediate_image_size');</pre>
<p>The custom function to add the favicon image size can be very simple:</p>
<pre class="brush:php">function add_intermediate_image_size($sizes) {
	add_image_size('favicon', 16, 16, true);
	$sizes[] = 'favicon';
	return $sizes;
 }</pre>
<p>However, since we only want to create an optimized file when uploading or selecting a file specifically for use as a favicon, we need to add a bit more code:</p>
<pre class="brush:php">function add_intermediate_image_size($sizes) {
	$img = array('width' =&gt; 0, 'height' =&gt; 0, 'crop' =&gt; true);
	if ( $this-&gt;is_custom_media() ) {
		$img['width'] = $this-&gt;icon_dimensions['w'];
		$img['height'] = $this-&gt;icon_dimensions['h'];
	}
	add_image_size($this-&gt;icon_size, $img['width'], $img['height'], $img['crop']);
	$sizes[] = $this-&gt;icon_size;
	return $sizes;
 }</pre>
<p>This updated function does the following:</p>
<ol>
<li>Creates a default array with zeroed-out values for the intermediate image (more on why later)</li>
<li>Checks if the current request is initiated by Favicon Rotator (e.g. uploading/selecting an image via the admin page).  If so, set actual width/height values for favicon image (using object variables)</li>
<li>Adds image size to WordPress</li>
<li>Adds size name (e.g. &#8216;favicon&#8217;) to array of intermediate images sizes (using an object variable)</li>
<li>Return updated array of intermediate image sizes to filter</li>
</ol>
<p>The reason why we create an array with zeroed-out values for the image dimensions is because the intermediate image sizes may be requested in multiple situations (e.g. when deleting an image attachment from WordPress) so we need to add a valid size to the list of intermediate sizes whenever it is requested.  However, since we don&#8217;t want to actually <em>create</em> an additional favicon file for images unless they are uploaded/selected via Favicon Rotator&#8217;s admin page, we set the width/height to 0, which WordPress will then skip when creating intermediate images.</p>
<h3>That&#8217;s a wrap!</h3>
<p>By adding this functionality, favicons from large images look better <em>and</em> load faster, which makes this a worthwhile update for me.  As with most updates, I don&#8217;t really know where I&#8217;m going next (since I usually include everything I want to before updating), so any further updates will likely be based on user feedback.  If you have any requests, make sure to <a href="http://archetyped.com/tools/favicon-rotator/#respond" title="Provide feedback for Favicon Rotator">leave a comment</a> to let me know how Favicon Rotator can be improved.</p>
<p><a href="http://archetyped.com/lab/favicon-rotator-1-1-optimized-icons/"> Favicon Rotator 1.1: Optimized Icons</a> was originally published on <a href="http://archetyped.com">Archetyped</a> on August 20, 2010 02:10pm</p>]]></content:encoded>
			<wfw:commentRss>http://archetyped.com/lab/favicon-rotator-1-1-optimized-icons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lab &#8250; Making of: Favicon Rotator</title>
		<link>http://archetyped.com/lab/making-of-favicon-rotator/</link>
		<comments>http://archetyped.com/lab/making-of-favicon-rotator/#comments</comments>
		<pubDate>Tue, 17 Aug 2010 20:46:28 +0000</pubDate>
		<dc:creator>Sol</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Favicon]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Story]]></category>
		<category><![CDATA[WebDev]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://archetyped.com/?p=607</guid>
		<description><![CDATA[From a one-line of hack I was inspired to make a "quick and simple" plugin for Wordpress. This is the story of how Favicon Rotator came to be.]]></description>
			<content:encoded><![CDATA[<p>From a one-line of hack I was inspired to make a <em>&#8220;quick and simple&#8221;</em> plugin for WordPress.  This is the story of how <a href="http://archetyped.com/tools/favicon-rotator/" title="Favicon Rotator">Favicon Rotator</a> came to be.</p>
<h3>Inspiration</h3>
<p>When designing this site, I created several different <a href="http://wikipedia.org/wiki/Favicon" target="_blank">favicons</a>.  I narrowed it down to the icons that I liked best, but in the end, I couldn&#8217;t decide on just one.</p>
<div id="attachment_609" class="wp-caption alignnone" style="width: 310px"><img class="size-full wp-image-609" title="Favorite Favicons" src="http://archetyped.com/wp-content/uploads/favorite_favicons.gif" alt="" width="300" height="70" /><p class="wp-caption-text">Favorite Favicons</p></div>
<p>Then I thought, &#8220;why not both?&#8221; and so with a simple line of code, I rewarded my indecision and setup the site&#8217;s theme to randomly choose between the two different favicons each time the site was loaded.</p>
<pre class="brush:xml;gutter:false">&lt;link rel="icon" type="image/gif" href="&lt;?php bloginfo('template_directory'); ?&gt;/images/favicon_&lt;?php echo rand(1, 2); ?&gt;.gif" /&gt;
</pre>
<p>It was a quick solution and I was happy with the end result, but maintainability is a big thing for me and I had thought that it would be great if a site&#8217;s favicon could be easily added or changed as simply as adding a photo to a post in WordPress.  Even better, if <em>multiple</em> icons were added, it would automatically rotate through them, displaying a random icon each time the site is loaded.  I&#8217;m not sure if anyone else does that or even wanted such an ability, but after adding multiple icons to this site, I knew it was something I dug.</p>
<h3>Exploration</h3>
<p>Once I <a href="http://archetyped.com/lab/cornerstone-we-have-compatibility/" title="Cornerstone: We have compatibility!">reached a milestone</a> in <a href="http://archetyped.com/tools/cornerstone/" title="Cornerstone">Cornerstone</a>, I decided to spend some time exploring some of the other ideas I had swirling around in my head.  Favicon Rotator was one of the ideas I decided to work on because I felt I could finish it quickly and would be good experience for the next phase of Cornerstone (administration UI&#8217;s, etc.).</p>
<h4>Planning</h4>
<p>The first step was planning out the plugin.  The concept was pretty simple (add/manage favicon from admin page) and the ideas I had for implementation (mostly) clear, but I find that it&#8217;s a good first step to get those ideas out on paper or screen.  Doing this helps to clarify the purpose and expectations for the project, making for a much smoother workflow overall.</p>
<p>I manage the majority of my projects using a customized version of <a href="http://www.tiddlywiki.com/" target="_blank">TiddlyWiki</a> (a small and fast self-contained wiki), so the first thing I did was create a new project and set about listing all of the features I envisioned for this project.  <strong>Total time:</strong> 5 minutes.</p>
<div id="attachment_610" class="wp-caption alignnone" style="width: 510px"><img class="size-full wp-image-610" title="Feature List" src="http://archetyped.com/wp-content/uploads/favicon-rotator_features.png" alt="" width="500" height="281" /><p class="wp-caption-text">Feature List: Different colors indicate feature progress</p></div>
<h4>Wireframes</h4>
<p>While not always necessary, <a href="http://en.wikipedia.org/wiki/Website_wireframe" target="_blank">wireframing</a> is a quick way to iterate through ideas to optimize a layout.  The goal was to make it incredibly simple to add a favicon to the site, so sketching out a few wireframes of the admin interface to make it as simple as possible would be time well spent.</p>
<div id="attachment_612" class="wp-caption alignnone" style="width: 160px"><a href="http://archetyped.com/wp-content/uploads/favrot_wf_01.gif"><img class="size-thumbnail wp-image-612" title="Initial Wireframes - Rapid Iteration" src="http://archetyped.com/wp-content/uploads/favrot_wf_01-150x150.gif" alt="" width="150" height="150" /></a><p class="wp-caption-text">Initial Wireframes - Rapid Iteration</p></div>
<p>I drew out the wireframes with a thick sharpie to keep focus on the overall UI design and to keep from getting lost in the little details at this point.  I love to take the time to focus on the tiniest details, but at this phase the big picture was the priority so that I could move to the next phase quickly.  This worked out really well and helped me to arrive at an overall layout that I was happy to move forward with after a few iterations. <strong>Total time:</strong> 45 minutes.</p>
<div id="attachment_611" class="wp-caption alignnone" style="width: 160px"><a href="http://archetyped.com/wp-content/uploads/favrot_wf_02.gif"><img class="size-thumbnail wp-image-611" title="Final Wireframes" src="http://archetyped.com/wp-content/uploads/favrot_wf_02-150x150.gif" alt="" width="150" height="150" /></a><p class="wp-caption-text">Final Wireframes</p></div>
<h3>Experimentation</h3>
<p>Now that I knew what I wanted the plugin to do and how I wanted it to work, it was now time to develop it!  This was the basic order of events during development:</p>
<ol>
<li>Build administration UI
<ul>
<li>Setup layout (based on wireframes)</li>
<li>Add functionality to elements (“add new” button, “remove icon” buttons, “save changes” button, etc.)</li>
</ul>
</li>
<li>Handle retrieving icon(s) from the database</li>
<li>Handle saving icon selection(s) to the database</li>
<li>Handle uploading and selecting images to use as icons</li>
<li>Randomly select an icon and display it when site is loaded</li>
</ol>
<h4>1. Build administration UI</h4>
<p>Building the UI was quick and simple thanks to the wireframes.  I&#8217;ve also used much of WordPress&#8217; own CSS classes for many UI elements (buttons, headers, etc.), which I think is always a good idea because it makes it easier for users to use (since they&#8217;re already familiar with WP&#8217;s UI), it saves time when building the UI, and it will remain consistent with the rest of WordPress&#8217; admin UI if they ever change the official design.  For the icon containers themselves, I&#8217;ve decided to keep the design rather simple, but may decide to make them a bit more &#8220;WordPress-y&#8221; in the future so that it looks fully integrated.</p>
<div id="attachment_602" class="wp-caption alignnone" style="width: 400px"><img class="size-full wp-image-602" title="Favicon Management" src="http://archetyped.com/wp-content/uploads/favicon-rotator_admin-page.png" alt="" width="390" height="230" /><p class="wp-caption-text">Favicon Management UI</p></div>
<h4>2. Handle retrieving icon(s) from the database</h4>
<p>Since the functionality to actually <em>add</em> an icon to the list had not yet been developed (see step 4), I started off by adding some temporary data to the <code>wp_options</code> table where I would be storing the icon selections.  Using that data, I developed the functionality to retrieve those values and build an element with the necessary icon information to be displayed to the user.  Icon data was also added to a hidden form field that was updated whenever the icon selection was changed.</p>
<h4>3. Handle saving icon selection(s) to the database</h4>
<p>Though users added/removed favicons in a very visual &#8220;point and click&#8221; way, saving their changes was a much more straightforward process.  Data for the selected icons are stored in a hidden form field which is updated with a dash of Javascript whenever favicons are added and removed from the list.  When the &#8220;Save changes&#8221; button is clicked, the value from this form field is simply saved to the database.</p>
<h4>4. Handle uploading and selecting images to use as icons</h4>
<p>WordPress already has fairly robust media management capabilities built-in and since I&#8217;ve used it quite a bit in Cornerstone, I decided to use it in Favicon Rotator too.  Mind you, this is not simply plug and play as there are a number of hoops to jump through to place nice with WordPress.  Thankfully, no hacks are needed (mostly) because WordPress&#8217; provides the necessary plugin hooks.</p>
<h5><strong>Launching the media upload UI</strong></h5>
<p>Launching the media upload UI is pretty straightforward.  Just build a link to <code>admin/media_upload.php</code> with the appropriate URL query variables set.</p>
<pre class="brush:html;gutter:false">&lt;a href="http://archetyped.com/wp-admin/media-upload.php?post_id=0&amp;tab=type&amp;type=fvrt_icon&amp;fvrt_action=1&amp;TB_iframe=1" class="thickbox"&gt;Open Upload UI&lt;/a&gt;
</pre>
<p>The necessary URL query variables are:</p>
<ul>
<li><code>post_id</code> &#8211; The ID of the post that the media is being uploaded for.  Media uploads are referred to as &#8220;attachments&#8221; in WordPress because they are <em>attached</em> to other content (posts, pages, etc.).  In this case, we don&#8217;t want to attach the upload icons to a specific post, so we just set this variable to <code>0</code></li>
<li><code>tab</code> &#8211; The media management UI has several tabs, each with a different purpose (upload media, browse library, etc.).  The upload tab is displayed by default, but in this case, this variable is set to <code>type</code>, which will cause the type URL variable to be processed (see below for why)</li>
<li><code>type</code> &#8211; The type of media being uploaded/browsed (image, audio, video, etc.).  When the type is processed, WordPress fires an action formatted as <code>media_upload_{type}</code>, so in our case, an action called <code>media_upload_fvrt_icon</code> will be fired.  I can then hook into this action to gain control over how uploads are handled.</li>
<li><code>fvrt_action</code> &#8211; Specifies that the media upload UI was launched by Favicon Rotator.  This is a custom variable I add so that I can quickly determine whether to hook into the actions and filters fired by the media upload UI (e.g. when the UI is launched to upload images for a post, I don&#8217;t need to hook into it).</li>
<li><code>TB_iframe</code> &#8211; Whether or not the media UI is launched in an iframe (which it is in when used on the post edit form and in Favicon Rotator).</li>
</ul>
<p>Also, by adding class=&#8221;thickbox&#8221; to the link, the resulting link will open in a non-modal popup (a lightbox) without leaving the current page.  I also needed to load the necessary files for the thickbox functionality:</p>
<pre class="brush:php;gutter:false">add_thickbox(); //Adds thickbox files to page header</pre>
<h5>Add an &#8220;Add icon&#8221; button to uploaded media</h5>
<p>Once the media upload UI is displayed, we need a way for the user to select an image and add it to the list of favicons.  To do this, Favicon Rotator hooks into the <code>attachment_fields_to_edit</code> filter to modify the fields/buttons that are displayed when viewing an attachment&#8217;s details in the media management UI.</p>
<p>Using this filter, all extraneous edit fields and buttons are removed (to keep things as simple as possible) and the &#8220;Add icon&#8221; button is added.</p>
<p>The end result is a clean UI with a simple button to add an icon to the list</p>
<div id="attachment_613" class="wp-caption alignnone" style="width: 160px"><a href="http://archetyped.com/wp-content/uploads/media_details_default.png"><img class="size-thumbnail wp-image-613" title="Default Media Details" src="http://archetyped.com/wp-content/uploads/media_details_default-150x150.png" alt="" width="150" height="150" /></a><p class="wp-caption-text">Default Media Details</p></div>
<div id="attachment_614" class="wp-caption alignnone" style="width: 160px"><a href="http://archetyped.com/wp-content/uploads/media_details_favrot.png"><img class="size-thumbnail wp-image-614" title="Media Details for favicon selection" src="http://archetyped.com/wp-content/uploads/media_details_favrot-150x150.png" alt="" width="150" height="150" /></a><p class="wp-caption-text">Media Details for favicon selection</p></div>
<h5>Adding the selected icon to the list</h5>
<p>Once the user has clicked the &#8220;Add icon&#8221; button for an image, the final step is sending the selected icon from the media management UI (in the &#8220;lightbox&#8221; popup) into the favicon list on the admin page.  This is handled in essentially the same way that images are inserted into posts.  The basic methodology is as follows:</p>
<ol>
<li>User clicks &#8220;Add icon&#8221; button for an image.  This submits a form.</li>
<li>The form submission is evaluated to determine which image the &#8220;Add icon&#8221; button was clicked for</li>
<li>The image&#8217;s details (ID, source URL, and file name) are sent via Javascript to the underlying admin page</li>
<li>The media upload UI is closed</li>
</ol>
<p>Once the admin page receives the image data, it builds a new icon container for the image and adds it to the list of icons.  The image&#8217;s ID is then added to the hidden form field that corresponds to the icons in the list.</p>
<p>Finally (phew!), when the user clicks the &#8220;Save changes&#8221; button, the icon ID&#8217;s are saved in the <code>wp_options</code> table for safe-keeping.  This is the other benefit of using WordPress&#8217; built-in media management functionality&#8211; since attachments in WordPress are essentially posts, we can simply save their ID and reference it to retrieve the rest of their data.  As a bonus, WordPress also has several functions specifically for retrieving attachment data (source URL, etc.) which saves us from having to develop those tools ourselves.</p>
<p>Development was clearly the longest phase in the entire process, but it  was sped up greatly by the initial planning and wireframing that gave me  a clear direction for the entire development phase.  <strong>Total time:</strong> 19 hours</p>
<h3>Wrap Up</h3>
<p>The initial motivation for developing Favicon Rotator was to provide others with the capability to display multiple favicons randomly like this site does.  However, during development, I realized that the real value of the plugin was quite a bit simpler and made it useful to a much wider audience.  Favicon Rotator enables anyone to easily add a favicon to their site (regardless of whether or not they want to rotate between multiple icons).  Users no longer need to edit theme files, manually upload images via FTP, or copy/paste URL&#8217;s to favicon files just to simply add a favicon to their site.</p>
<p>This is a capability that is missing in WordPress at the moment, so while I&#8217;m happy that I made a plugin that accomplishes my initial (though obscure) goal of icon randomness, I&#8217;m actually more enthused about the plugin&#8217;s potential to enable users to easily do something that may have been out of reach for them previously.</p>
<p><a href="http://archetyped.com/lab/making-of-favicon-rotator/"> Making of: Favicon Rotator</a> was originally published on <a href="http://archetyped.com">Archetyped</a> on August 17, 2010 10:46am</p>]]></content:encoded>
			<wfw:commentRss>http://archetyped.com/lab/making-of-favicon-rotator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tools &#8250; Favicon Rotator</title>
		<link>http://archetyped.com/tools/favicon-rotator/</link>
		<comments>http://archetyped.com/tools/favicon-rotator/#comments</comments>
		<pubDate>Fri, 13 Aug 2010 05:33:38 +0000</pubDate>
		<dc:creator>Sol</dc:creator>
				<category><![CDATA[Feature]]></category>
		<category><![CDATA[Customization]]></category>
		<category><![CDATA[Favicon]]></category>
		<category><![CDATA[Freeware]]></category>
		<category><![CDATA[Image]]></category>
		<category><![CDATA[Media]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://archetyped.com/?post_type=software&#038;p=600</guid>
		<description><![CDATA[<p><em>Easily Add a Favicon to any Wordpress Site</em></p>Easily set any number of favicons that will be rotated through, randomly displaying a different favicon when someone visits your site.]]></description>
			<content:encoded><![CDATA[<p><em>Easily Add a Favicon to any WordPress Site</em></p><p>Favicon Rotator is a free plugin for WordPress that makes it incredibly simple to add a <a href="http://wikipedia.org/wiki/Favicon" target="_blank">favicon</a> to your site.  Favicon Rotator uses WordPress&#8217; own media management features to upload and add a favicon to your site so there is nothing new to learn.  If you know how to add an image to a post, you can add a favicon to your site!</p>
<h3>What&#8217;s in a name&#8230;</h3>
<p>Favicon Rotator gets its name from its unique support for <strong>multiple icons</strong>.  If you add more than one icon to the list, Favicon Rotator will <em>rotate</em> through the different icons, randomly displaying a different icon when someone visits the site.</p>
<h3>How to Use</h3>
<ol>
<li>Install and Activate plugin</li>
<li>Go to the <strong>Appearance &gt; Favicon</strong> page from the administration menu</li>
<li>Click the &#8220;Add new&#8221; button to upload or select icons to use from your media library</li>
<li>Click the &#8220;x&#8221; button in the upper right-hand corner to remove any icons you no longer what in the rotation.</li>
<li>Save changes and you&#8217;re done!  The favicon(s) you&#8217;ve selected will now be displayed when someone visits your site.</li>
</ol>
<h3>Screenshots</h3>
<div id="attachment_601" class="wp-caption alignleft" style="width: 182px"><img class="size-full wp-image-601" title="Favicon submenu in Appearance Admin Menu" src="http://archetyped.com/wp-content/uploads/favicon-rotator_admin-menu.png" alt="" width="172" height="192" /><p class="wp-caption-text">Favicon submenu in Appearance Admin Menu</p></div>
<div id="attachment_602" class="wp-caption alignleft" style="width: 400px"><img class="size-full wp-image-602" title="Favicon Management" src="http://archetyped.com/wp-content/uploads/favicon-rotator_admin-page.png" alt="" width="390" height="230" /><p class="wp-caption-text">Favicon Management</p></div>
<h3>Download</h3>
<p><a href="http://wordpress.org/extend/plugins/favicon-rotator/">Download now from WordPress.org</a></p>
<p><a href="http://archetyped.com/tools/favicon-rotator/"> Favicon Rotator</a> was originally published on <a href="http://archetyped.com">Archetyped</a> on August 12, 2010 07:33pm</p>]]></content:encoded>
			<wfw:commentRss>http://archetyped.com/tools/favicon-rotator/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Blog &#8250; Question of the Day &#8211; August 9, 2010</title>
		<link>http://archetyped.com/blog/question-of-the-day-august-9-2010/</link>
		<comments>http://archetyped.com/blog/question-of-the-day-august-9-2010/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 09:07:50 +0000</pubDate>
		<dc:creator>Sol</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Choice]]></category>
		<category><![CDATA[Decision]]></category>
		<category><![CDATA[Question of the Day]]></category>

		<guid isPermaLink="false">http://archetyped.com/?p=596</guid>
		<description><![CDATA[Is it easier to make a decision when you only have one option? Question of the Day &#8211; August 9, 2010 was originally published on Archetyped on August 9, 2010 11:07pm]]></description>
			<content:encoded><![CDATA[<p>Is it easier to make a decision when you only have one option?</p>
<p><a href="http://archetyped.com/blog/question-of-the-day-august-9-2010/"> Question of the Day &#8211; August 9, 2010</a> was originally published on <a href="http://archetyped.com">Archetyped</a> on August 9, 2010 11:07pm</p>]]></content:encoded>
			<wfw:commentRss>http://archetyped.com/blog/question-of-the-day-august-9-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lab &#8250; Redactor &#8211; Quality time with TinyMCE</title>
		<link>http://archetyped.com/lab/redactor-quality-time-with-tinymce/</link>
		<comments>http://archetyped.com/lab/redactor-quality-time-with-tinymce/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 08:46:18 +0000</pubDate>
		<dc:creator>Sol</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Dev]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Privacy]]></category>
		<category><![CDATA[Redact]]></category>
		<category><![CDATA[WebDev]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://archetyped.com/?p=595</guid>
		<description><![CDATA[Today I moved on to working on working on implementing redaction in Wordpress' visual editor, otherwise known as TinyMCE.]]></description>
			<content:encoded><![CDATA[<p>Today I moved on to working on working on implementing redaction in WordPress&#8217; visual editor, otherwise known as <a href="http://tinymce.moxiecode.com/">TinyMCE</a>.</p>
<p>In general, I&#8217;m not a huge fan of WYSIWYG editors because what-you-see-is-<strong>not</strong>-always-what-you-get, and TinyMCE is no exception.  It&#8217;s neither the fastest nor the most lightweight editor out there, but it is quite capable and the plugin API is rather robust.  Over time, I have given the visual editor some leeway and have become accustomed to letting it handle my paragraph tags and bolded text.  Honestly, it&#8217;s not half bad and I find myself writing in the visual editor more and more often, only switching to the HTML editor when I need to make sure the proper markup is written.</p>
<p>At any rate, since I use WordPress&#8217; visual editor fairly regularly (along with the majority of WordPress users out there, I&#8217;d assume), I decided to add redaction support to TinyMCE.  I <em>could</em> do it quick and dirty and just add a button that wraps the redact shortcode around the selected text, but that wouldn&#8217;t be fun.  Instead, redacting text in the visual editor will function very similarly to the way you would make text bold or italic.  Basically, click the &#8220;Redact text&#8221; button on the toolbar and the text styling is changed to indicate that it is redacted.  I think this is one of the benefits of the visual editor as visual cues make navigating through a post&#8217;s content far faster for most users than looking at the HTML source.</p>
<p>So far, I&#8217;ve:</p>
<ul>
<li>Added a button to TinyMCE&#8217;s toolbar to activate/deactivate redaction</li>
<li>Setup CSS to provide visual cues to identify redacted text</li>
<li>Started work on wrapping selected text in the redact shortcode</li>
</ul>
<p>The interesting bit about TinyMCE is that you can add additional HTML markup in the post content to help with the visual cues in the visual editor, but when you view the source, you can swap out the presentation markup for the markup you want to be saved with the post content.  This makes it incredibly customizable in terms of presentation <em>and</em> final markup.</p>
<p>The main thing that&#8217;s left is to refine how selected text is wrapped with the shortcode.  Some things to consider when manipulating the selected text:</p>
<ol>
<li>Is the selected text part of a larger chunk of chunk of text that has already been redacted?</li>
<li>Should the selected text be wrapped or unwrapped with the shortcode?</li>
<li>What should happen when no text is selected?</li>
</ol>
<p>We definitely want to avoid nesting redaction shortcodes within each other so I&#8217;m going to take some time on this to make sure it works the way one would expect it to in the different situations.</p>
<p>I&#8217;m planning on putting together a tutorial on making a TinyMCE plugin for WordPress once I&#8217;ve released this plugin.  Even though I&#8217;ve done a fair amount of TinyMCE plugin development specifically for WordPress, I think having a quick step by step reference for creating a plugin for the visual editor would be a nice way to jump start development on the next one.  Hopefully others will find it useful as well.</p>
<p>On a different but related note, I was surprised today when I noticed that WordPress was telling me to update Redactor as a new version has just become available.</p>
<p><img class="alignnone size-full wp-image-598" title="Update Redactor" src="http://archetyped.com/wp-content/uploads/redactor_update_2010-08-09.png" alt="" width="416" height="61" /></p>
<p>I found this perplexing at first because I was sure I hadn&#8217;t published an updated version of the plugin that I didn&#8217;t know about on my own development version of WordPress.  It appears that the &#8220;Updates&#8221; section of WordPress merely looks for matching plugin names on WordPress.org (as opposed to checking the plugin URI as well) as it turns out that I was being notified of a new version of a <a href="http://wordpress.org/extend/plugins/redactor/">different plugin</a> with the same name.</p>
<p>I checked whether there was already a plugin called &#8220;Redactor&#8221; on WordPress&#8217; website last week to avoid confusion when I first started writing about my plugin.  I figured this other plugin must be very new.  It is, it was released <em>today</em>.</p>
<p>What&#8217;s cool is that it has many of the same features that have or am planning to implement in my plugin (from manual shortcodes to automated text replacement).  It&#8217;s always nice to have more than one option.  While Redactor is just a code name for the plugin during development, I was considering the possibility of using it as the official name (since it&#8217;s rather descriptive of it&#8217;s functionality), but I guess the decision has been made for me.  Thanks!</p>
<p><a href="http://archetyped.com/lab/redactor-quality-time-with-tinymce/"> Redactor &#8211; Quality time with TinyMCE</a> was originally published on <a href="http://archetyped.com">Archetyped</a> on August 9, 2010 10:46pm</p>]]></content:encoded>
			<wfw:commentRss>http://archetyped.com/lab/redactor-quality-time-with-tinymce/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lab &#8250; Redactor: A New Privacy Plugin for WordPress</title>
		<link>http://archetyped.com/lab/redactor-a-new-privacy-plugin-for-wordpress/</link>
		<comments>http://archetyped.com/lab/redactor-a-new-privacy-plugin-for-wordpress/#comments</comments>
		<pubDate>Sat, 07 Aug 2010 05:30:14 +0000</pubDate>
		<dc:creator>Sol</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://archetyped.com/?p=592</guid>
		<description><![CDATA[I cracked open Eclipse today and started working on a new WordPress plugin that I got the idea for .  The plugin is called Redactor and as the name implies, it allows authors to redact text in posts.  In other words, you can mask, obfuscate, or otherwise hide text in posts that you want to ...]]></description>
			<content:encoded><![CDATA[<p>I cracked open Eclipse today and started working on a new WordPress plugin that I got the idea for <a href="http://archetyped.com/lab/what-you-should-know-now-is-that-dump-is-now-know/" title="What you should know now is that Dump is now Know">yesterday</a>.  The plugin is called Redactor and as the name implies, it allows authors to <em>redact</em> text in posts.  In other words, you can mask, obfuscate, or otherwise hide text in posts that you want to keep private.</p>
<p>The idea came about as a way to allow people to write without any filtering while still having piece of mind that they aren&#8217;t fully disclosing all of their personal information with the rest of the internet.  Personal journals, freewriting, and partially declassified government documents are all perfect places for Redactor.</p>
<p>Today I setup the plugin framework, created the <a href="http://codex.wordpress.org/Shortcode_API">shortcode</a> to wrap around text that should be redacted, and added a button to the HTML text editor to automatically wrap selected text with the shortcode.</p>
<h3>Example</h3>
<p>Say an author wrote the following:</p>
<pre>Hello, my name is Joanie and I love Chachi</pre>
<p>This might be a bit too revealing for just anyone to see so, the author <em>redacts</em> some of the text</p>
<pre>Hello, my name is &#91;redacted&#93;Joanie&#91;/redacted&#93; and I love &#91;redacted&#93;Chachi&#91;/redacted&#93;</pre>
<p>When this post is viewed publicly, it will be displayed as</p>
<pre>Hello, my name is XXXXXX and I love XXXXXX</pre>
<p>Personally-identifying information redacted!  Take that ID thieves!</p>
<p>Pretty spiffy right?  The benefit is that the author (and any other logged in user with sufficient permissions) will still be able to see the original unredacted text in all its glory.</p>
<p>Of course, the plugin will be customizable, allowing authors to change the text used in place of redacted text.</p>
<h3>Next</h3>
<p>I have a bunch of ideas for this plugin, but my plan is to get the basic functionality working and release the plugin quickly.  To this end, the next step is adding a TinyMCE plugin so that authors can specify text to be redacted from the visual editor without having to manually write out the shortcode.</p>
<p><a href="http://archetyped.com/lab/redactor-a-new-privacy-plugin-for-wordpress/"> Redactor: A New Privacy Plugin for WordPress</a> was originally published on <a href="http://archetyped.com">Archetyped</a> on August 6, 2010 07:30pm</p>]]></content:encoded>
			<wfw:commentRss>http://archetyped.com/lab/redactor-a-new-privacy-plugin-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blog &#8250; Question of the Day &#8211; August 6, 2010</title>
		<link>http://archetyped.com/blog/question-of-the-day-august-6-2010/</link>
		<comments>http://archetyped.com/blog/question-of-the-day-august-6-2010/#comments</comments>
		<pubDate>Sat, 07 Aug 2010 04:56:54 +0000</pubDate>
		<dc:creator>Sol</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Question of the Day]]></category>
		<category><![CDATA[Start]]></category>

		<guid isPermaLink="false">http://archetyped.com/?p=593</guid>
		<description><![CDATA[What if you have to start out small? Question of the Day &#8211; August 6, 2010 was originally published on Archetyped on August 6, 2010 06:56pm]]></description>
			<content:encoded><![CDATA[<p>What if you have to start out small?</p>
<p><a href="http://archetyped.com/blog/question-of-the-day-august-6-2010/"> Question of the Day &#8211; August 6, 2010</a> was originally published on <a href="http://archetyped.com">Archetyped</a> on August 6, 2010 06:56pm</p>]]></content:encoded>
			<wfw:commentRss>http://archetyped.com/blog/question-of-the-day-august-6-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lab &#8250; What you should know now is that Dump is now Know</title>
		<link>http://archetyped.com/lab/what-you-should-know-now-is-that-dump-is-now-know/</link>
		<comments>http://archetyped.com/lab/what-you-should-know-now-is-that-dump-is-now-know/#comments</comments>
		<pubDate>Fri, 06 Aug 2010 02:40:44 +0000</pubDate>
		<dc:creator>Sol</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[Cornerstone]]></category>
		<category><![CDATA[Lesson]]></category>
		<category><![CDATA[Update]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://archetyped.com/?p=589</guid>
		<description><![CDATA[<p><em>Another adventure of bug squashing and lessons learned</em></p>Archetyped is updated and ]]></description>
			<content:encoded><![CDATA[<p><em>Another adventure of bug squashing and lessons learned</em></p><p>I completed the changes to this site that I started <a href="http://archetyped.com/lab/names-taken-bugs-squashed/" title="Names Taken, Bugs Squashed">yesterday</a> but didn&#8217;t finish because of some last-minute bugs (glad to have found them before uploading).  The main issue keeping me from updating the site was that the featured posts functionality of <a href="http://archetyped.com/tools/cornerstone/" title="Cornerstone">Cornerstone</a> was not working properly.  Featured posts in Cornerstone are similar to WordPress&#8217; own sticky posts functionality in that it lets you place specific posts in front of the normal chronologically-sorted posts, which is useful when you want to highlight certain content.  Featured posts in Cornerstone differs from WordPress&#8217; sticky posts in that it offers somewhat more customizability and control over how/when featured posts are displayed.</p>
<p>However, due to some changes last night, the featured posts weren&#8217;t being retrieved for output on the site.  To be quite honest, I wasn&#8217;t sure what I could have changed yesterday that could have broken the featured posts functionality, so I had no idea what to expect when I started investigating it this morning.  Thankfully the issue was relatively minor and was causing the wrong section ID to be used when attempting to retrieve featured posts for a specific section of the site.  I tightened up a couple conditional statements to make sure the section ID is properly retrieved and featured posts were once again working!</p>
<p>With that out of the way, I proceeded to prepare for deploying all updates to the production server.  Since everything had been updated to work with WordPress 3.0+, the first order of business was upgrading the production server to WordPress 3.0.1.  After that, I updated Cornerstone and the site&#8217;s theme files.  I cleared my cache, hit refresh, and held my breath.  The site loaded up fine and everything is working great on the production server!  The final step was changing the Dump section to <a href="http://archetyped.com/know/" title="Know">Know</a>, which basically entailed adjusting the section&#8217;s title, slug, and icon.</p>
<p>It took longer than expected for such a small change (all I originally intended to do was change the name of a section), but in the end the site is much better and more stable for the work that went into it.</p>
<h3>Lessons learned</h3>
<p>As with any situations that require troubleshooting, there are always lessons to be learned.  Here are some I lessons learned or reaffirmed today:</p>
<ul>
<li><strong>Test, Test, Test</strong> &#8211; before any update big or small, I always follow the same workflow:
<ol>
<li>Develop and test the code on my computer</li>
<li>Upload updates to the offsite <em>staging</em> server (basically a private mirror of the public production server) to test for issues not found while testing locally</li>
<li>Upload updates to the <em>production </em>server (the public site) and run through tests to confirm no issues exist</li>
</ol>
<p>The goal is of course to avoid any downtime on the public site and this basic workflow has saved me many headaches on all of my projects.  I should note that prior to each step I also backup all relevant files and databases so that I can revert to a working version very quickly and start fresh if things get too messy while I troubleshoot an issue.</li>
<li><strong>Exercise caution when manipulating WordPress&#8217; post queries</strong> &#8211; Cornerstone hooks into the post query process in several modules (permalink rewriting, content types, featured posts, etc.) and I feel rather comfortable manipulating the query variables to retrieve the posts that I want, but it is also very easy to invalidate the query with just a small change.  Vigilance is key when manipulating post query objects.</li>
</ul>
<p>I enjoy troubleshooting because I like the challenge of finding elegant solutions to problems.  Nonetheless, I am glad that I was able to work out the issues rather quickly today because it feels good to have my production site running the latest version of WordPress.</p>
<h3>Next</h3>
<p>I&#8217;m about to start working on 2 small WordPress plugins that I have been thinking about recently (one of them since this morning).  One is intended to improve privacy and the other will make it easier to customize a site&#8217;s favicon from within WordPress.  I&#8217;m looking forward to it.</p>
<p><a href="http://archetyped.com/lab/what-you-should-know-now-is-that-dump-is-now-know/"> What you should know now is that Dump is now Know</a> was originally published on <a href="http://archetyped.com">Archetyped</a> on August 5, 2010 04:40pm</p>]]></content:encoded>
			<wfw:commentRss>http://archetyped.com/lab/what-you-should-know-now-is-that-dump-is-now-know/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
