<?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 &#8250; CMS</title>
	<atom:link href="http://archetyped.com/tag/cms/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; 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>
		<item>
		<title>Lab &#8250; Cornerstone: We have compatibility!</title>
		<link>http://archetyped.com/lab/cornerstone-we-have-compatibility/</link>
		<comments>http://archetyped.com/lab/cornerstone-we-have-compatibility/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 09:01:32 +0000</pubDate>
		<dc:creator>Sol</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[Compatibility]]></category>
		<category><![CDATA[Cornerstone]]></category>
		<category><![CDATA[Dev]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://archetyped.com/?p=542</guid>
		<description><![CDATA[<p><em>Compatibility is so (not) overrated</em></p>I made good progress today as I completed far more than expected while working to make Cornerstone compatible with Wordpress 3.0]]></description>
			<content:encoded><![CDATA[<p><em>Compatibility is so (not) overrated</em></p><p>Well that didn&#8217;t take as long as I expected it to.  While I still have some tests to run through, all work has been completed to make <a href="http://archetyped.com/tools/cornerstone/" title="Cornerstone">Cornerstone</a> compatible with WordPress 3.0!  I was expecting this to take at least 2-3 days due to the amount of code I had to check, but after finishing what I had scheduled for today, I decided to just keep chugging along and ended up finishing everything on my list without much delay.</p>
<p>Here&#8217;s a rundown of what I did today:</p>
<h3>Structure</h3>
<h4>Permalink Structure</h4>
<p>The first thing on the list was adjusting the permalink structure for posts with custom post types.  By default, the structure for posts with custom post types is <code>/post-type/post-name/</code>, which doesn&#8217;t cut it when posts can now be added to a specific section regardless of their post type.  What we want is for all posts to use <code>/section-name/post-name/</code> as their permalink structure.  I didn&#8217;t think this would be too difficult to rectify, and thankfully it wasn&#8217;t.  A quick look at <code>get_permalink()</code> (which Cornerstone hooks into to filter a post&#8217;s permalink) revealed that posts with custom post types were processed separately from standard posts:</p>
<pre class="brush:php;first-line:110">elseif ( in_array($post-&gt;post_type, get_post_types( array('_builtin' =&gt; false) ) ) )
	return get_post_permalink($post, $leavename, $sample);</pre>
<p>So in addition to hooking into <code>post_link</code> for standard posts, we also need to hook into <code>post_type_link</code> (which is called in <code>get_post_permalink()</code>).  Thankfully, both filter hooks pass the default permalink along with the current post&#8217;s data (except that <code>post_link</code> supplies the entire post object while <code>post_type_link</code> only supplies the post&#8217;s ID) so the same handler can be used for both:</p>
<pre class="brush:php">add_filter('post_link', $this-&gt;m('post_link'), 10, 2); //Standard posts
add_filter('post_type_link', $this-&gt;m('post_link'), 10, 2);  //Custom post types</pre>
<p>With this additional hook added, posts with custom post types now have <code>/section-name/post-name/</code> as their permalink structure.</p>
<h4>Post Sections</h4>
<p><a href="http://archetyped.com/wp-content/uploads/cnr_structure_section_selec.gif"><img class="alignnone size-full wp-image-549" title="Section Selection" src="http://archetyped.com/wp-content/uploads/cnr_structure_section_selec.gif" alt="" width="327" height="112" /></a></p>
<p>Next on my list was providing the UI on the edit forms for custom post types to select the section the post should be saved to.  Prior to WordPress 3.0, I added the section selector to the edit form sidebar by hooking into the <code>do_meta_boxes</code> action.  This works exactly as it should on the edit form for custom post types in WordPress 3.0, save for one difference&#8211; the action hook now passes the <em>post type</em> of the post currently being edited (as opposed to being hardcoded as &#8220;post&#8221; in earlier versions of WordPress).  Since we only wanted the section selector to be added to the sidebar of the <em>post </em>edit form, that&#8217;s exactly what the handler looked for before adding the section selector meta box:</p>
<pre class="brush:php">if ( 'post' == $type &amp;&amp; 'side' == $context )
	add_meta_box($this-&gt;add_prefix('section'), 'Section', $this-&gt;m('admin_post_sidebar_section'), 'post', 'side', 'high');</pre>
<p>Since the post type can now be variable, the condition for adding a the section selector meta box needed to be expanded a bit:</p>
<pre class="brush:php">$child_types = get_post_types(array('show_ui' =&gt; true, '_builtin' =&gt; false));
$child_types[] = 'post';
$side_context = 'side';
$priority = 'high';
if ( in_array($type, $child_types) &amp;&amp; $side_context == $context )
	add_meta_box($this-&gt;add_prefix('section'), __('Section'), $this-&gt;m('admin_post_sidebar_section'), $type, $context, $priority);</pre>
<p>Basically, all custom post types that would have an edit form are retrieved, the &#8220;post&#8221; post type is added to the array of possible post types, and a check is performed to see if the current post type is included in this array.  If so, the meta box is added and the section selector is displayed on edit form&#8217;s sidebar.  I also took this opportunity to move some of the values in the <code>add_meta_box</code> call out into separate variables to further simplify future maintenance.</p>
<h3>Taxonomies</h3>
<p><a href="http://archetyped.com/wp-content/uploads/cnr_taxonomies.gif"><img class="alignnone size-full wp-image-550" title="Taxonomies" src="http://archetyped.com/wp-content/uploads/cnr_taxonomies.gif" alt="" width="327" height="359" /></a><br />
I honestly thought it would take longer than it did to go through and fix the compatibility issues with permalinks and section selection so that was really all I had intended to work on today.  After finishing them so quickly, I decided that I would work on getting the rest of the edit form for custom post types to work properly.  The first thing was adding access to the standard post taxonomies (specifically, categories and post tags) on custom post type edit forms.</p>
<p>Once again, I thought I was in for some digging through WordPress&#8217; code, and once again, it turned out to be incredibly simple.  WordPress provides the <a href="http://codex.wordpress.org/Function_Reference/register_taxonomy_for_object_type"><code>register_taxonomy_for_object_type()</code></a> function that makes it very simple to connect a previously-registered taxonomy to a post type.  I could have used this, but WordPress <em>also</em> provides the ability to automatically register a taxonomy with a post type at the same time the post type itself is registered.  This is accomplished by adding a single item to the arguments array passed to <code>register_post_type()</code> when registering a new post type:</p>
<pre class="brush:php">//...additional arguments for the post type being registered
'taxonomies' =&gt; get_object_taxonomies('post')
</pre>
<p>By using <code>get_object_taxonomies('post')</code>, we can be sure that any taxonomies registered to the standard &#8220;post&#8221; post type is also registered to our custom content types.  In the future, I may add functionality to enable more control over which custom content types will inherit the taxonomies from WordPress&#8217; built-in post type, but for now this makes the edit form for custom content types functional and useful for those wanting to use the same basic taxonomies with all content types.</p>
<h3>Content Type Fields</h3>
<p><a href="http://archetyped.com/wp-content/uploads/cnr_content_type_fields.gif"><img class="alignnone size-full wp-image-548" title="Content Type Fields" src="http://archetyped.com/wp-content/uploads/cnr_content_type_fields.gif" alt="" width="247" height="327" /></a><br />
The final thing that remained to make Cornerstone compatible with WordPress 3.0 was displaying a content type&#8217;s predefined fields on the edit form.  The implementation prior to WordPress 3.0 employed multiple hooks to make it all work (since custom post type functionality was not as fully fleshed out as it is in 3.0), but now all I needed was one hook:</p>
<pre class="brush:php">add_action('do_meta_boxes', $this-&gt;m('admin_do_meta_boxes'), 10, 3);
//Build UI on post edit form
</pre>
<p>The handler is also very simple.  Once it confirms that the context is appropriate for building the fields for a content type, the processing is handed off to an instance object of the content type definition which has a method to build the fields in meta boxes for output on the edit form:</p>
<pre class="brush:php">function admin_do_meta_boxes($type, $context, $post) {
	//Validate $type. Should be 'post', 'page', or a custom post type for our purposes
	if ( in_array($type, array_merge(array_keys($this-&gt;get_types()), array('post', 'page'))) ) {
		//Get content type definition
		$ct =&amp; $this-&gt;get_type($post);
		//Pass processing to content type instance
		$ct-&gt;admin_do_meta_boxes($type, $context, $post);
	}
}
</pre>
<h3>Coming up next</h3>
<p>With the compatibility work on Cornerstone out of the way, I can now continue where I left off before upgrading to WordPress 3.0 and start developing additional features and functionality for Cornerstone.  Here&#8217;s my basic plan:</p>
<ol>
<li>Complete compatibility testing, fixing any small issues I missed</li>
<li>Develop UI for managing custom content types and their fields</li>
</ol>
<p>The content type/field management UI will be heavy with &#8220;drag and drop&#8221; functionality to make adding and customizing content types very quick and simple.  This is one of the last major milestones I&#8217;m working towards before Cornerstone enters the public beta phase, so I am pretty excited to get started on this.</p>
<p>At the same time, I have a few other ideas for projects that have been dancing around in my head for the past few days and I&#8217;ve been itching to explore some of them.  I don&#8217;t intend to stay away from Cornerstone development for too long, but several of these projects will actually be using Cornerstone as the foundation of their functionality so I&#8217;ll still be working on Cornerstone as I explore these other projects.</p>
<p><a href="http://archetyped.com/lab/cornerstone-we-have-compatibility/"> Cornerstone: We have compatibility!</a> was originally published on <a href="http://archetyped.com">Archetyped</a> on August 2, 2010 11:01pm</p>]]></content:encoded>
			<wfw:commentRss>http://archetyped.com/lab/cornerstone-we-have-compatibility/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lab &#8250; Cornerstone: All Content Types Aboard!</title>
		<link>http://archetyped.com/lab/cornerstone-all-content-types-aboard/</link>
		<comments>http://archetyped.com/lab/cornerstone-all-content-types-aboard/#comments</comments>
		<pubDate>Sat, 31 Jul 2010 06:36:21 +0000</pubDate>
		<dc:creator>Sol</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[Content Types]]></category>
		<category><![CDATA[Hooks]]></category>
		<category><![CDATA[Post Types]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://archetyped.com/?p=527</guid>
		<description><![CDATA[<p><em>Queries are blind when it comes to custom content types</em></p>Work continues on Wordpress 3.0 compatibility for Cornerstone.  Custom content types get their piece of the pie.]]></description>
			<content:encoded><![CDATA[<p><em>Queries are blind when it comes to custom content types</em></p><p>My main goal today was including all content items (regardless of post type) for display on the front end.  This would return content type functionality to what it was prior to WordPress 3.0.  Custom post types are now 1st-class citizens in WordPress, each with their own place in the <code>post_type</code> column of the <code>wp_posts</code> table.  They&#8217;ve been promoted to the <em>big show</em> and are no longer relagated to the <code>wp_postmeta</code> table with all the other <em>secondary</em> post data.</p>
<p>For my purposes, custom <em>content types</em> (Cornerstone&#8217;s extension of WordPress&#8217; own <em>post types</em>) should generally not interfere with the retrieval of content, but serve primarily to indicate the types of metadata a content item can/should contain.  Since I&#8217;ve decided to synchronize custom content types with WordPress&#8217; custom post types for better compatibility, we now have a small issue since the default posts query (e.g. used on the home page, etc.) only retrieves content items with &#8220;post&#8221; as the post type, so items with other content types are left in the dust and not retrieved.  Isn&#8217;t that just how it always is?  You get a leg up in the world, only to be pushed back down.  I say equality for all content types!</p>
<p>To rectify this and allow all content items regardless of content type to be retrieved in default post queries, I&#8217;ve hooked into the <code>pre_get_posts</code> action to modify the query before any posts are retrieved.</p>
<pre class="brush:php">add_action('pre_get_posts', $this-&gt;m('pre_get_posts'), 20);
//Calls internal method</pre>
<p>When the <code>pre_get_posts</code> action is fired, Cornerstone&#8217;s <code>pre_get_posts</code> method:</p>
<ul>
<li>Checks to make sure the query is a standard post query</li>
<li>Retrieves all custom content types and adds them to the <code>post_type</code> query variable</li>
</ul>
<pre class="brush:php">/**
 * Modifies query parameters to include custom content types
 * @param WP_Query $q Reference to WP_Query object being used to perform posts query
 * @see WP_Query for reference
 */
function pre_get_posts($q) {
	$qv =&amp; $q-&gt;query_vars;
	$pt =&amp; $qv['post_type'];

	/* Do not continue processing if:
	 * &gt; In admin section
	 * &gt; Single object requested
	 * &gt; More than one post type is already specified
	 * &gt; Post type other than 'post' is supplied
	 */
	if ( is_admin()
	|| is_singular()
	|| ( is_array($pt)
		&amp;&amp; ( count($pt) &gt; 1
			|| 'post' != $pt[0] )
		)
	|| !in_array($pt, array('post', null))
	) {
		return false;
	}
	$default_types = $this-&gt;get_default_post_types();
	$custom_types = array_diff(array_keys($this-&gt;get_types()), $default_types);
	if ( !count($custom_types) )
		return false;
	//Wrap post type in array
	if ( empty($pt) || is_null($pt) )
		$pt = array('post');
	if ( !is_array($pt) )
		$pt = array($pt);
	//Add custom types to query
	foreach ( $custom_types as $type ) {
		$pt[] = $type;
	}
}
</pre>
<p>With the additional content types added to the query, all content items are now retrieved in standard post queries (ultimately, each custom content type will have the option to define whether it is included in standard queries or not).  All is now right with the world and I can sleep soundly knowing that custom content types are getting a <a href="http://www.thefreedictionary.com/fair+shake">fair shake</a>.</p>
<h3>Next</h3>
<p>Work on content types continues as permalinks for content with custom post types need to have the ability use the <code>section-name/post-name</code> permalink structure enabled by Cornstone (by default it&#8217;s <code>post-type/post-name</code>).  Once that&#8217;s sorted, I&#8217;m heading back to the admin section to work on the edit form for items with custom post types.</p>
<p><a href="http://archetyped.com/lab/cornerstone-all-content-types-aboard/"> Cornerstone: All Content Types Aboard!</a> was originally published on <a href="http://archetyped.com">Archetyped</a> on July 30, 2010 08:36pm</p>]]></content:encoded>
			<wfw:commentRss>http://archetyped.com/lab/cornerstone-all-content-types-aboard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lab &#8250; Cornerstone: Content Types in WordPress 3.0</title>
		<link>http://archetyped.com/lab/cornerstone-content-types-in-wordpress-3-0/</link>
		<comments>http://archetyped.com/lab/cornerstone-content-types-in-wordpress-3-0/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 08:42:43 +0000</pubDate>
		<dc:creator>Sol</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[Content Types]]></category>
		<category><![CDATA[Cornerstone]]></category>
		<category><![CDATA[Dev]]></category>
		<category><![CDATA[WebDev]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://archetyped.com/?p=516</guid>
		<description><![CDATA[<p><em>Work starts on Wordpress 3.0 Compatibility</em></p>Today I began working on making Cornerstone compatible with Wordpress 3.0.  Content types (whose primary role is to allow creation of additional metadata fields for post types) was first on the list.]]></description>
			<content:encoded><![CDATA[<p><em>Work starts on WordPress 3.0 Compatibility</em></p><p>Today I began working on making <a href="http://archetyped.com/tools/cornerstone/" title="Cornerstone">Cornerstone</a> compatible with WordPress 3.0.  Content types (whose primary role is to allow creation of additional metadata fields for post types) was first on the list.</p>
<p>Prior to 3.0, I had developed my own implementation for creating, editing, and managing different post types from the admin menu.  Now that WordPress&#8217; own custom post type functionality was ready for these tasks, my first task was migrating the functionality of my custom implementation to use WordPress&#8217; implementation.  I considered my implementation a stopgap since I knew WordPress would have custom post type management sooner or later, so it wasn&#8217;t an unexpected task.  Nonetheless, I wasn&#8217;t exactly looking forward to it.  In the end, it wasn&#8217;t all that bad.</p>
<h3>Registering Custom Content Types</h3>
<p>The first thing I had to do was integrate my custom content type definitions with WordPress&#8217; own custom post type array.  While they are fairly similar at the base level, Cornerstone&#8217;s content types contain somewhat more data and functionality than WordPress&#8217; custom post type objects (mostly because Cornerstone&#8217;s content types also contain metadata field definitions for the custom content type), so I couldn&#8217;t just use WordPress&#8217; post type implementation.  In the end, it was a simple matter of calling the <code>register_post_type()</code> function during the registration of each custom content type in Cornerstone.  This way, custom post types are registered for each custom content type defined by Cornerstone and some of the work is handed off to WordPress.</p>
<h3>Administration Menus</h3>
<p>One of the main changes to WordPress&#8217; custom post type functionality in 3.0 is that management functionality can now be automatically setup for each custom post type.  Simply put, each custom post type now has a section in the admin menu with functionality to manage, edit, and add new items of the custom post type.  Registering each content type with WordPress (using the same <code>register_post_type()</code> call as above) handled this, and I was able to offload a bunch of custom functionality in Cornerstone onto WordPress itself.</p>
<h3>Content Item Management</h3>
<p>WordPress now handles listing all custom post type items, so displaying all items with a custom post type was fairly straightforward (it mostly consisted of me removing my custom handlers for this functionality).</p>
<p>In my custom implementation, all content items (e.g. posts) with custom content types were still identified as <em>posts</em> in the database as WordPress&#8217; custom post type functionality had not been completely integrated into the core prior to 3.0.  Instead, the custom type of a content item was saved as post metadata, which I felt was safer since I wasn&#8217;t sure how things would be changed in later revisions of the custom post type functionality.</p>
<h3>Tomorrow</h3>
<ol>
<li>
<h4>Including items with custom content types in default post query</h4>
<p>In 3.0, items with custom post types are not retrieved in standard post queries, meaning that they would not be displayed inline with other posts when content items chronologically (e.g. as in a blog).  The primary purpose of custom content types in Cornerstone is to allow different content items to contain specific metadata fields based on their content type.  This means that they should also have the option to be included in the standard post listing on a blog, so I&#8217;ll probably have to hook into the queries to make sure items with custom post types are included in the default post query.</li>
<li>
<h4>Global edit form functionality</h4>
<p>Also, since all content items were basically still defined as <em>posts</em> as far as WordPress was concerned pre-3.0, it was easily possible to assign new functionality to the post edit form that would show up when creating/editing items regardless of content type.  I will have to look into this a bit to determine what best way to add functionality (e.g. extra meta boxes) to the edit form for all items regardless of content type.</li>
</ol>
<p><a href="http://archetyped.com/lab/cornerstone-content-types-in-wordpress-3-0/"> Cornerstone: Content Types in WordPress 3.0</a> was originally published on <a href="http://archetyped.com">Archetyped</a> on July 28, 2010 10:42pm</p>]]></content:encoded>
			<wfw:commentRss>http://archetyped.com/lab/cornerstone-content-types-in-wordpress-3-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tools &#8250; Cornerstone</title>
		<link>http://archetyped.com/tools/cornerstone/</link>
		<comments>http://archetyped.com/tools/cornerstone/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 04:26:04 +0000</pubDate>
		<dc:creator>Sol</dc:creator>
				<category><![CDATA[Feature]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[Freeware]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://archetyped.com/?p=479</guid>
		<description><![CDATA[<p><em>Enhanced Content Management for Wordpress</em></p>Cornerstone transforms Wordpress into a full-fledged Content Management System.  Say adios to the hacks and tricks used to shoehorn your posts into something that resembles a non-blog site and say hello to content management simplified.]]></description>
			<content:encoded><![CDATA[<p><em>Enhanced Content Management for WordPress</em></p><p>Cornerstone transforms WordPress into a full-fledged Content Management System.  Say <em>adios </em>to the hacks and tricks used to shoehorn your posts into something that resembles a non-blog site and say hello to content management simplified.</p>
<h2>Key Features</h2>
<h3>Structure</h3>
<p>Using categories as pseudo sections to organize your posts?  No longer!  Pages are WordPress&#8217; rightful sections and adding a post to a section is now as simple as selecting a page from a drop-down list while editing a post.</p>
<h4>Benefits</h4>
<ul>
<li><strong>Canonical &amp; logical permalinks</strong> – Posts are in a single section, and that&#8217;s how it should be.  WordPress ensures that every piece of content on the site has a canonical URI (a single URI for the content).  Cornerstone makes this URI logical so that you can tell where in the site&#8217;s structure (i.e. the section) the post is located at a glance, not what category it&#8217;s in or what year it was written in.</li>
<li><strong>&#8220;Hackable&#8221; site structure</strong> – the URI for a piece of content should represent the location of the content in the site&#8217;s structure.  For example, given the following URI:
<pre>http://mysite.com/awesome/content-item</pre>
<p>With only a glance at the URI, we know that <code>content-item</code> is in the <code>awesome</code> section of the <code>mysite.com</code> website.  In the same way, this URI is &#8220;hackable&#8221; in that we can effectively navigate through the site&#8217;s structure by removing parts of the URI.  For example, to navigate up to the parent section, we just remove content-item from the URI and load the new URI to navigate to the awesome section.</li>
</ul>
<h3>Enhanced Content Metadata</h3>
<p>Add preset form fields to enter metadata based on post type.  Manually creating and editing custom fields for each post is a thing of the past!  Easily enter and manage additional metadata for a rich content website (e.g. CRM, real estate listings, etc.)</p>
<h4>Benefits</h4>
<ul>
<li><strong>Optimized productivity</strong> – Drag and drop creation of metadata fields for different post types.  Add fields once and they will be accessible whenever creating/editing a post.</li>
<li><strong>Customizable </strong>– Create new fields composed of multiple sub-fields (e.g. Address field contains sub-fields for Street Address, City, State, and Zipcode).  Customize the layout of fields on the edit form and how their data is used in themes.</li>
</ul>
<h3>RSS Everywhere</h3>
<p>Allow users to subscribe to your site&#8217;s content with more flexibility.  In addition to WordPress&#8217; standard RSS feeds, visitors can now also subscribe to updates in the following ways:</p>
<ul>
<li>Content in a section</li>
<li>Content in a section by tag</li>
<li>Content in a section by category</li>
</ul>
<h3>Site Customization</h3>
<p>Various options and features to let you customize and personalize your site.</p>
<p>Examples:</p>
<ul>
<li><strong>Enhanced Page Title </strong>– Automatically format title based on page type (home, archive, search, etc.)</li>
<li><strong>Featured Content</strong> – Select a category that will be used to define featured content to be displayed prominently on your site</li>
</ul>
<p><a href="http://archetyped.com/tools/cornerstone/"> Cornerstone</a> was originally published on <a href="http://archetyped.com">Archetyped</a> on July 27, 2010 06:26pm</p>]]></content:encoded>
			<wfw:commentRss>http://archetyped.com/tools/cornerstone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lab &#8250; WordPress as CMS &#8211; Making the Connection</title>
		<link>http://archetyped.com/lab/wordpress-as-cms-making-the-connection/</link>
		<comments>http://archetyped.com/lab/wordpress-as-cms-making-the-connection/#comments</comments>
		<pubDate>Sat, 03 Feb 2007 21:03:11 +0000</pubDate>
		<dc:creator>Sol</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[Dev]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http:/archetyped.com/wordpress/wordpress-as-cms-making-the-connection/</guid>
		<description><![CDATA[One of the things that excited me (and scared me) about being able to create an unlimited number of content types was the connections that could be formed between items of different types. What excited me about this was the &#8220;automatic&#8221; nature of it&#8211; being able to define a connection between one content type and ...]]></description>
			<content:encoded><![CDATA[<p>One of the things that excited me (and scared me) about being able to create an unlimited number of content types was the connections that could be formed between items of different types.  What excited me about this was the &#8220;automatic&#8221; nature of it&#8211; being able to define a connection between one content type and another, and then everything else would take care of itself.  What scared me, was I wasn&#8217;t exactly sure <em>how</em> I was going to do this.</p>
<p>I spent some time yesterday working out the specifics of storing connections between content types and connections between different items (posts) and I&#8217;m pretty happy with the result.</p>
<h5>An example of how connections can be useful:</h5>
<p>Say you have 2 content types:</p>
<ol>
<li>Recipes</li>
<li>Ingredients</li>
</ol>
<p>Of course, all recipes must contain ingredients, so we need to tell the CMS that these two content types are connected.  We can also define the <em>type</em> of connection between these items (&#8220;One to One&#8221; or &#8220;One to Many&#8221;).</p>
<ul>
<li>One to One: One item of one content type can connect to one item of another content type</li>
<li>One to Many: One item of one content type can connect to several items of another content type</li>
</ul>
<p>Will a recipe need to connect to just one ingredient, or will it need to connect to several?  In this case, we would want to be able to connect a recipe to several ingredients, so we&#8217;re going to create a One to Many relationship between Recipes and Ingredients.</p>
<p>Now, when I&#8217;m adding a new recipe, thanks to the connection between these two content types, a list of ingredients will be displayed in the form to select ingredients that the recipe uses.  Since this is a One to Many relationship, each ingredient has a checkbox next to it so that I can select multiple ingredients from the list.  If it were a One to One relationship, the ingredients would be displayed as a drop-down list, which would only allow for one ingredient to be selected.</p>
<p>I really like the possibilities of this feature, but I think the goal now is to make it <em>usable</em>.  In my opinion, it&#8217;s quite powerful as a feature, but it&#8217;s also somewhat abstract.  So I&#8217;ve got to find a way to make it instantly clear how this feature could be useful to a user.</p>
<p><a href="http://archetyped.com/lab/wordpress-as-cms-making-the-connection/"> WordPress as CMS &#8211; Making the Connection</a> was originally published on <a href="http://archetyped.com">Archetyped</a> on February 3, 2007 11:03am</p>]]></content:encoded>
			<wfw:commentRss>http://archetyped.com/lab/wordpress-as-cms-making-the-connection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lab &#8250; WordPress as CMS &#8211; Dynamic Forms</title>
		<link>http://archetyped.com/lab/wordpress-as-cms-dynamic-forms/</link>
		<comments>http://archetyped.com/lab/wordpress-as-cms-dynamic-forms/#comments</comments>
		<pubDate>Wed, 24 Jan 2007 09:51:07 +0000</pubDate>
		<dc:creator>Sol</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[Dev]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http:/archetyped.com/wordpress/wordpress-as-cms-dynamic-forms/</guid>
		<description><![CDATA[While I&#8217;m still working out the exact method to define a content type, I&#8217;m far enough along that I was able to start working on the code to display the extra forms for each content type. The idea is simple: Select a content type, and the additional form fields for that content type appear below ...]]></description>
			<content:encoded><![CDATA[<p>While I&#8217;m still working out the exact method to define a content type, I&#8217;m far enough along that I was able to start working on the code to display the extra forms for each content type.</p>
<p>The idea is simple: Select a content type, and the additional form fields for that content type appear below the main form.</p>
<p>Today, I built a working example of just that.  Most of the work now will go into making this functionality more robust and flexible.</p>
<p><a href="http://archetyped.com/lab/wordpress-as-cms-dynamic-forms/"> WordPress as CMS &#8211; Dynamic Forms</a> was originally published on <a href="http://archetyped.com">Archetyped</a> on January 23, 2007 11:51pm</p>]]></content:encoded>
			<wfw:commentRss>http://archetyped.com/lab/wordpress-as-cms-dynamic-forms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lab &#8250; WordPress as CMS &#8211; Content Types</title>
		<link>http://archetyped.com/lab/wordpress-as-cms-content-types/</link>
		<comments>http://archetyped.com/lab/wordpress-as-cms-content-types/#comments</comments>
		<pubDate>Sat, 20 Jan 2007 00:35:08 +0000</pubDate>
		<dc:creator>Sol</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[Dev]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http:/archetyped.com/blog/wordpress-as-cms-content-types/</guid>
		<description><![CDATA[I&#8217;m currently working on the Content Types feature of my CMS plugin for WordPress. As , I think this is an important feature for a CMS that is truly extensible and flexible enough to be used for any purpose. At the moment, I&#8217;m working on determining the best way to define a Content Type and ...]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently working on the Content Types feature of my CMS plugin for WordPress.  As <a href="http://archetyped.com/lab/wordpress-as-cms-new-features-part-1-content-types/" title="Wordpress as CMS - New Features Part 1: Content Types">previously discussed</a>, I think this is an important feature for a CMS that is truly extensible and flexible enough to be used for <em>any</em> purpose.</p>
<p>At the moment, I&#8217;m working on determining the best way to define a Content Type and its options in the database.  Some types of content will use data from <code>wp_posts</code> along with data from other tables (joins), while others will be totally separate, so it&#8217;s important that the definition format is robust enough to handle all sorts of types.  From there, the next step is to implement that format so that I can easily (and efficiently) pull all data (including custom metadata from other tables) for a post (or group of posts).</p>
<p><a href="http://archetyped.com/lab/wordpress-as-cms-content-types/"> WordPress as CMS &#8211; Content Types</a> was originally published on <a href="http://archetyped.com">Archetyped</a> on January 19, 2007 02:35pm</p>]]></content:encoded>
			<wfw:commentRss>http://archetyped.com/lab/wordpress-as-cms-content-types/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lab &#8250; WordPress as CMS &#8211; New Features Part 2: Media Management</title>
		<link>http://archetyped.com/lab/wordpress-as-cms-new-features-part-2-media-management/</link>
		<comments>http://archetyped.com/lab/wordpress-as-cms-new-features-part-2-media-management/#comments</comments>
		<pubDate>Mon, 27 Nov 2006 02:37:00 +0000</pubDate>
		<dc:creator>Sol</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[Dev]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http:/archetyped.com/blog/wordpress-as-cms-new-features-part-2-media-management/</guid>
		<description><![CDATA[Compared to other content types, media types (video, image, audio, etc.) are differentiated by certain characteristics: Media files generally need to be uploaded to the server They can be embedded in other content (posts) They require specific markup to be displayed It is because of these special characteristics that content types classified as media are ...]]></description>
			<content:encoded><![CDATA[<p>Compared to other content types, media types (video, image, audio, etc.) are differentiated by certain characteristics:</p>
<ul>
<li>Media files generally need to be uploaded to the server</li>
<li>They can be embedded in other content (posts)</li>
<li>They require specific markup to be displayed</li>
</ul>
<p>It is because of these special characteristics that content types classified as media are not treated the same as other content types.  For the most part, media will be added when adding another content type (an mp3 for a podcast, a thumbnail image for an article, etc.).  Nonetheless, they are still treated as a separate content item (which means that they may be selected and embedded in any other content item as well).</p>
<p>Some differences regarding how media items are handled:</p>
<ul>
<li>Upload Capability &#8211; Media files may be uploaded</li>
<li>File Organization &#8211; Media files are saved into directories based on file type</li>
<li>Embed Media in a Post &#8211; Media can be easily added to a post by clicking an &#8220;Insert Media&#8221; button, viewing a gallery of media items (sortable and filterable), and selecting the media item(s) to insert.</li>
<li>Automatic Media Viewers &#8211; When a media item is displayed, it is automatically wrapped in a the proper markup to allowing viewing.  For example:
<ul>
<li>Images (gif, jpg, png) are wrapped in <code>&lt;img&gt;</code> tags</li>
<li>Flash Videos (flv) are wrapped in a flash video player</li>
<li>Mp3 files are wrapped in a flash-based audio player</li>
</ul>
<p>The nice thing is that these viewers are simply the default templates defined for each of the content types.  This means that:</p>
<ol>
<li>Viewers can be easily modified</li>
<li>Default viewers can be easily overridden via a template for further customization</li>
</ol>
</li>
</ul>
<p>Adding new media types is as simple as adding any other content types (define the characteristics of the media type, create default viewer template, and you&#8217;re done).</p>
<p>Personally, I like the automatic viewers for displaying media the most.  This relieves template creators from having to do this task, and all they have to do is add a simple template tag (<code>show_media()</code>, for example).</p>
<p><a href="http://archetyped.com/lab/wordpress-as-cms-new-features-part-2-media-management/"> WordPress as CMS &#8211; New Features Part 2: Media Management</a> was originally published on <a href="http://archetyped.com">Archetyped</a> on November 26, 2006 04:37pm</p>]]></content:encoded>
			<wfw:commentRss>http://archetyped.com/lab/wordpress-as-cms-new-features-part-2-media-management/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lab &#8250; WordPress as CMS &#8211; New Features Part 1: Content Types</title>
		<link>http://archetyped.com/lab/wordpress-as-cms-new-features-part-1-content-types/</link>
		<comments>http://archetyped.com/lab/wordpress-as-cms-new-features-part-1-content-types/#comments</comments>
		<pubDate>Mon, 27 Nov 2006 00:52:30 +0000</pubDate>
		<dc:creator>Sol</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[Dev]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http:/archetyped.com/blog/wordpress-as-cms-new-features-part-1-content-types/</guid>
		<description><![CDATA[One of the best things to come out of beta testing this plugin in a real-world situation is the advent of new features. Had I been developing the plugin in complete isolation, it&#8217;s quite likely these new features could have been implemented completely differently (or not at all). There are several little enhancements and optimizations ...]]></description>
			<content:encoded><![CDATA[<p>One of the best things to come out of beta testing this plugin in a real-world situation is the advent of new features.  Had I been developing the plugin in complete isolation, it&#8217;s quite likely these new features could have been implemented completely differently (or not at all).</p>
<p>There are several little enhancements and optimizations all over, but there are two new features that I believe have the most impact:</p>
<h3>Content Types</h3>
<p>Different types of content have different attributes.  While most content types share some attributes (i.e. title, main content text, categories, etc.), they often diverge from each other in their &#8220;supporting&#8221; attributes (aka metadata).  In the case of <a href="http://cinemaparadise.org">Cinema Paradise</a>, a film would have a certain set of metadata (director, length, country, etc.), while an event would have completely different set of metadata (time/date, location, etc.).</p>
<p>For a site needing to manage several different content types, there are two important questions:</p>
<ul>
<li>How is the metadata added to a post (and how is it stored)?</li>
<li>How is the metadata displayed?</li>
</ul>
<h4>Adding metadata to a post</h4>
<p>Generally, additional metadata is added to a post via custom fields and stored in the <code>wp_postmeta</code> table.  When you write a new post, simply fill in the appropriate custom fields (or add new ones), and you&#8217;re good to go.  This is fine for blog sites (where blog posts are the only content type), but for a content-heavy site where several different types of content are added regularly (articles, blog posts, etc.), this just isn&#8217;t acceptable.  Not only would a large list of custom fields be disorganized and hard to manage, but on a site with multiple users (each of whom may only need to work with certain content types), there is a good chance that mistakes will be made (e.g. typing metadata into the wrong custom field, etc.).</p>
<p>To make the creation and management of different content types simple and effective, the following functionality was (or will be) introduced into the plugin:</p>
<ul>
<li><strong>Add new content types</strong></li>
<p>Users are able to create new content types and define its attributes.  For each attribute, users may define the different characteristics such as data type, default values, etc.  Some examples of data type are:</p>
<ul>
<li>Date</li>
<li>Address</li>
<li>Phone Number</li>
<li>Database Lookup &#8211; (Creates a drop-down list of values fetched from the DB.  Used mostly to create relationships with other content types)</li>
<li>File Upload &#8211; (image/video uploads, etc.)</li>
</ul>
<p>The order and layout of the content type&#8217;s attributes can also be set.<br />
As an example, three content types from the Cinema Paradise site were &#8220;Director&#8221;, &#8220;Film&#8221;, and &#8220;Event&#8221;.  Here is a breakdown of each content type:</p>
<p><strong>Director</strong></p>
<ul>
<li>Name &#8211; Plain Text</li>
<li>Country &#8211; DB Lookup (List of Countries)</li>
</ul>
<p><strong>Film</strong></p>
<ul>
<li>Title &#8211; Post Title</li>
<li>Description &#8211; Post Content</li>
<li>Country &#8211; DB Lookup (List of Countries)</li>
<li>Director &#8211; DB Lookup (Items matching &#8220;Director&#8221; content type)</li>
<li>Genre(s) &#8211; Post Categories</li>
</ul>
<p><strong>Event</strong></p>
<ul>
<li>Event Title &#8211; Post Title</li>
<li>Event Description &#8211; Post Content</li>
<li>Start Time &#8211; Date</li>
<li>End Time &#8211; Date</li>
<li>Location &#8211; DB Lookup (Items matching &#8220;Location&#8221; content type)</li>
</ul>
<li><strong>Select content type for a post</strong></li>
<p>Once a content type has been created, it may be selected from a drop-down list in the Write Post form when creating or editing a post.  When a content type is selected, a form containing a field for each of the content type&#8217;s attributes will appear below the post content text box.  The user can then fill in this form with the appropriate metadata.</p>
<p>Each field in the form is not just a simple text box either.  A specially formatted form field will be displayed depending on the data type for each attribute.  For instance, a date field will have a field where a date (month/day/year) may be entered, along with a popup calendar for quick and easy date selection, and an address data type will have text fields for Street, City, State, Zipcode, and Country data to be entered.</p>
<p>This makes it simple to enter metadata for different content types, and because only the form fields necessary for that content type are displayed, the likelihood of user-error is greatly minimized.
</ul>
<h5>A note on metadata storage</h5>
<p>For the first implementation of this feature on Cinema Paradise&#8217;s site, a new table is created for each content type.  Since there were a finite amount of different content types to manage, I felt this was the best solution (faster/more specific queries, etc.).  However, I am currently reevaluating the implementation of how metadata is stored to best accommodate the creation of an unlimited number of different content types.  </p>
<h4>Displaying metadata for a post</h4>
<h5>Template Hierarchy</h5>
<p>Once a post has been assigned a content type, the focus now moves onto how to display this extra data.  First, when creating a new content type, a default template may be defined.  This template will be used if no templates have been set for a content type in the template directory.  If a template for a content type has been defined in the template directory, it will override the default template.  Currently, content type templates are defined by creating a file with the same name as the content type (this may change in the future to better differentiate content type template files from other template files).  Furthermore, content type templates may be defined on a per-section basis.  This means that content of a specific type (e.g. an article or an event) can be made to look different from one section to another.  Again, if a section-specific content type template is present, it will override both the global content type template file and the default content type template (only for posts in that section, of course).</p>
<h5>Custom Template Tags (Conceptual)</h5>
<p>Currently, metadata may be displayed simply by inserting <code>$post->attribute-name</code> into a template.  This works and is quite simple, but I would like to align the display of a post&#8217;s metadata with the main data of a post which can be displayed using template tags such as <code>the_title()</code>, <code>the_content()</code>, etc.  So for an event, a user could create template tags such as <code>event_location()</code>, <code>event_start()</code>, and <code>event_end()</code>.</p>
<p>Honestly, I don&#8217;t know whether this is practical to implement, or if it is even possible.  I need to look into this more.</p>
<p><a href="http://archetyped.com/lab/wordpress-as-cms-new-features-part-1-content-types/"> WordPress as CMS &#8211; New Features Part 1: Content Types</a> was originally published on <a href="http://archetyped.com">Archetyped</a> on November 26, 2006 02:52pm</p>]]></content:encoded>
			<wfw:commentRss>http://archetyped.com/lab/wordpress-as-cms-new-features-part-1-content-types/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
