<?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>Carrington &#187; Development</title>
	<atom:link href="http://text.carringtontheme.com/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://text.carringtontheme.com</link>
	<description>The CMS Theme Framework for WordPress</description>
	<lastBuildDate>Thu, 22 Jul 2010 21:15:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Carrington Core 3.0</title>
		<link>http://text.carringtontheme.com/2010/07/carrington-core-3-0/</link>
		<comments>http://text.carringtontheme.com/2010/07/carrington-core-3-0/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 21:15:55 +0000</pubDate>
		<dc:creator>Alex King</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://carringtontheme.com/?p=496</guid>
		<description><![CDATA[We’ve released a new version of the Carrington Core – the engine that powers the Carrington framework. This version has a few moderate list changes, some of which are pretty interesting. In particular:

Added support for custom post types (WordPress 3.0)
Support for child themes (including adding templates and plugins in child themes that do not exist [...]]]></description>
			<content:encoded><![CDATA[<p>We’ve released a new version of the Carrington Core – the engine that powers the Carrington framework. This version has a few moderate list changes, some of which are pretty interesting. In particular:</p>
<ul>
<li>Added support for custom post types (WordPress 3.0)</li>
<li>Support for child themes (including adding templates and plugins in child themes that do not exist in the parent theme)</li>
<li>Allow custom functions to be filtered into the Single and Comment template selection process (already supported in General context selection)</li>
<li>home.php is now only used in is_home() situations, not is_front_page() (reverses feature requested and added in v. 2.5)</li>
</ul>
<p>Other changes:</p>
<ul>
<li>Make the posts_per_page setting work as intended (only on initial query)</li>
<li>Support for nesting templates inside sub-directories in misc/ and forms/</li>
<li>Removed use of deprecated function `get_the_author_ID`. Replaced with 2.8 `get_the_author_meta` (since 2.8.0). Users of versions of WordPress prior to 2.8.0 should be aware this change will cause problems for them.</li>
<li>Define required Carrington settings in a more forgiving way, making it easier to use just part of Carrington on a site when desired</li>
<li>Make gallery settings (implemented in CSS) specific to each gallery</li>
<li>Added changelog</li>
</ul>
<p>Get the Carrington Core 3.0 release from the public SVN directory:</p>
<p>http://carrington.googlecode.com/svn/framework/tags/3.0</p>
]]></content:encoded>
			<wfw:commentRss>http://text.carringtontheme.com/2010/07/carrington-core-3-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Child Theme Support for /plugins</title>
		<link>http://text.carringtontheme.com/2010/05/child-theme-support-for-plugins/</link>
		<comments>http://text.carringtontheme.com/2010/05/child-theme-support-for-plugins/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 04:03:32 +0000</pubDate>
		<dc:creator>Alex King</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://carringtontheme.com/?p=482</guid>
		<description><![CDATA[Plugins added to the /plugins directory in child themes will now be auto-loaded after the /plugins files in the parent theme. The revision, for those inclined to review it.
Child theme support is getting broader testing and is working well from what we&#8217;ve seen. An updated release of Carrington is probably due in the near future. [...]]]></description>
			<content:encoded><![CDATA[<p>Plugins added to the /plugins directory in child themes will now be auto-loaded after the /plugins files in the parent theme. The <a href="http://code.google.com/p/carrington/source/detail?r=492">revision</a>, for those inclined to review it.</p>
<p>Child theme support is getting broader testing and is working well from what we&#8217;ve seen. An updated release of Carrington is probably due in the near future. If you&#8217;re seeing any issues with child themes with the latest Carrington core code, please <a href="http://code.google.com/p/carrington/issues/list">open a ticket</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://text.carringtontheme.com/2010/05/child-theme-support-for-plugins/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Post Type and Comment Meta Support</title>
		<link>http://text.carringtontheme.com/2010/05/post-type-and-comment-meta-support/</link>
		<comments>http://text.carringtontheme.com/2010/05/post-type-and-comment-meta-support/#comments</comments>
		<pubDate>Sun, 02 May 2010 20:18:46 +0000</pubDate>
		<dc:creator>Alex King</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://carringtontheme.com/?p=466</guid>
		<description><![CDATA[Support for post types (available in WordPress 3.0) using a type- prefix and comment meta using our standard meta-{key}- and meta-{key}-{value}- prefixes has landed in the development version of Carrington core (/framework/trunk). Play around with it and let us know if you run into any issues.
]]></description>
			<content:encoded><![CDATA[<p>Support for post types (available in WordPress 3.0) using a <code>type-</code> prefix and comment meta using our standard <code>meta-{key}-</code> and <code>meta-{key}-{value}-</code> prefixes has landed in the development version of Carrington core (<a href="http://code.google.com/p/carrington/source/browse/#svn/framework/trunk">/framework/trunk</a>). Play around with it and let us know if you run into any issues.</p>
]]></content:encoded>
			<wfw:commentRss>http://text.carringtontheme.com/2010/05/post-type-and-comment-meta-support/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Child Theme Support</title>
		<link>http://text.carringtontheme.com/2010/01/child-theme-support/</link>
		<comments>http://text.carringtontheme.com/2010/01/child-theme-support/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 06:46:31 +0000</pubDate>
		<dc:creator>Alex King</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://carringtontheme.com/?p=428</guid>
		<description><![CDATA[Child theme support has landed in the Carrington core framework. We&#8217;d love to get some additional real-world testing on this before we tag the next core version.
You can grab the latest from SVN on Google Code. Then simply replace the carrington-core directory in your theme with new version you have checked out from:
http://carrington.googlecode.com/svn/framework/trunk
and that should [...]]]></description>
			<content:encoded><![CDATA[<p>Child theme support has landed in the Carrington core framework. We&#8217;d love to get some additional real-world testing on this before we tag the next core version.</p>
<p>You can grab the latest from SVN on <a href="http://code.google.com/p/carrington">Google Code</a>. Then simply replace the carrington-core directory in your theme with new version you have checked out from:</p>
<p>http://carrington.googlecode.com/svn/framework/trunk</p>
<p>and that should do it.</p>
<p>Note that the way child theme support is implemented, your child theme can add new templates to your theme as well as overriding existing templates. I think this is necessary for Carrington &#8211; it allows you to create custom templates for your specific site and have them upgrade cleanly via the child theme.</p>
<p>Feedback welcome.</p>
<p>UPDATE:</p>
<p>The steps to test if you want to make a child theme for a Carrington theme (before this support is rolled out in new releases):</p>
<ol>
<li>Download the framework from SVN using the URL above and replace the carrington-core directory in your parent theme.</li>
<li><a href="http://www.google.com/search?hl=en&#038;q=how+to+create+a+child+theme+in+wordpress">Create your child theme</a> (which can include new Carrington templates).</li>
</ol>
<p>That&#8217;s it.</p>
]]></content:encoded>
			<wfw:commentRss>http://text.carringtontheme.com/2010/01/child-theme-support/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>The Carrington Framework Q&amp;A, Part II</title>
		<link>http://text.carringtontheme.com/2009/08/carrington-framework-qa-part-2/</link>
		<comments>http://text.carringtontheme.com/2009/08/carrington-framework-qa-part-2/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 18:05:25 +0000</pubDate>
		<dc:creator>Alex King</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://carringtontheme.com/?p=285</guid>
		<description><![CDATA[Who should use the Carrington framework?
It really depends on the needs of your site/theme. Carrington is all about making it easy for you to build the custom design and features needed for a specific site and set of content. If you look at the features of the Carrington framework and think &#8220;why would someone need [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Who should use the Carrington framework?</strong></p>
<p>It really depends on the needs of your site/theme. Carrington is all about making it easy for you to build the custom design and features needed for a specific site and set of content. If you look at the features of the Carrington framework and think &#8220;why would someone need that?&#8221;, then it probably isn&#8217;t for you.</p>
<p>Remember, WordPress can power more than just a blog &#8211; many of us use WordPress to build complex CMS web sites with a vast collection of sections, archives and content types. Most of the time when I describe how Carrington works to a fellow WordPress developer that builds rich CMS sites, they nod emphatically and &#8220;get it&#8221; right away.</p>
<p>Conversely, there are some folks who don&#8217;t see the need for the features provided by the Carrington framework. My guess is that if these people joined us at <a href="http://crowdfavorite.com">Crowd Favorite</a> to help build one of our standard sites, they&#8217;d have a different view of the value of Carrington. <img src='http://text.carringtontheme.com/wp/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Once you understand how Carrington works, you may want to use it even if you&#8217;re just building a very simple blog or web site. It isn&#8217;t harder than any other theme techniques and provides for much greater flexibility for the future.</p>
<p>There <em>is</em> a learning curve. Carrington introduces new concepts and features to WordPress themes. If you don&#8217;t want/need the customization ability provided by Carrington, it may not be the best option for you.</p>
<p><strong>How do I create a child theme from Carrington JAM?</strong></p>
<p>This is actually the wrong question. You don&#8217;t create a child theme from Carrington JAM because Carrington JAM isn&#8217;t a parent theme. JAM is a Carrington file and folder skeleton to help you easily get started using the concepts in the Carrington framework so you can create a theme of your own.</p>
<p>Remember, Carrington is a real framework like Rails for Ruby and Django for Python. The theme you create from Carrington JAM is your own theme, just like the application you build with Ruby on Rails is your own application.</p>
<p><strong>If I really want to can I create a child theme for Carrington Blog/Text/Mobile?</strong></p>
<p>Yes, any theme in WordPress can be a parent theme. You can read a tutorial about how to do this <a href="http://op111.net/53">here</a>. There are some limitations of how parent themes work in WordPress, so those are also shared by Carrington themes.</p>
<p>I think it would be great if someone would like to take an in-depth look at creating child themes from Carrington and created an FAQ/tutorial. Please let me know if you create one.</p>
<p>If it turns out some changes are needed to Carrington, we&#8217;ll certainly consider them.</p>
<p><strong>How do I upgrade the theme I built on Carrington?</strong></p>
<p>Like any good development framework, the framework is separate from the product itself. The Carrington framework resides in the carrington-core directory and can be upgraded separately from the rest of your Carrington-based theme when a new version of the core Carrington framework is available.</p>
<p><strong>With all of the template files, how do I tell what is getting loaded from where?</strong></p>
<p>Carrington includes a function to show the file location of each included file. Simply open up the functions.php file in your editor and change this code:</p>
<p><code>define('CFCT_DEBUG', false);</code></p>
<p>to:</p>
<p><code>define('CFCT_DEBUG', true);</code></p>
<p>and you will see file paths appear all throughout the theme. This makes it very easy to see what part of the theme is comprised of which template(s).</p>
<p><strong>Can I use just part of Carrington?</strong></p>
<p>Absolutely. Remember, Carrington is a 100% additive framework. You can bring in Carrington for just your site header, just post content, comments, etc. All you have to do is create the appropriate folder and file combinations where you want to use Carrington, and call the appropriate function (cfct_header(), cfct_content(), etc.) to invoke Carrington&#8217;s selection of a template from that folder.</p>
<p><strong>How do I use a custom taxonomy with Carrington?</strong></p>
<p>It&#8217;s common to use custom taxonomies when creating advanced CMS web sites. Carrington doesn&#8217;t try to guess your intentions with a custom taxonomy, instead you can teach it about your taxonomy.</p>
<p>Create functions that check for the named templates that you want to use with your custom taxonomy, then use the appropriate filters to add your function into the template selection used by Carrington. You can use the existing functions that work with tags as a guide.</p>
<p><strong>How do I do XYZ in Carrington?</strong></p>
<p>It obviously depends on what XYZ is, but it&#8217;s likely that you&#8217;d do it the way you would in any other theme. Since Carrington is a 100% additive framework, the standard way of doing anything in a WordPress theme should work just fine. The areas in which you can take advantage of additional Carrington functionality are around conditional presentation and display of content, data, etc.</p>
<p><strong>I find Carrington compelling, but I&#8217;m having trouble getting started &#8211; how can I get help?</strong></p>
<p>I recommend reading the documentation linked on the <a href="http://carringtontheme.com/developers/">Developers</a> page on this site, and the README files in each directory in our Carrington themes and participating <a href="http://crowdfavorite.com/forums/">community support forums</a>. Hopefully this information will be enough to get people going in most situations.</p>
<p>If you need additional help, you can also call the <a href="http://wphelpcenter.com">WordPress HelpCenter</a> and they can answer most Carrington questions you may have. <a href="http://crowdfavorite.com">Crowd Favorite</a> also provides commercial Carrington consulting and support (generally needs to be scheduled about 3-5 days in advance).</p>
<p><strong>I think I found a bug in Carrington, what do I do?</strong></p>
<p>Bug reports are best added to the <a href="http://code.google.com/p/carrington/issues/list">Issue tracker at Google Code</a>. If you&#8217;re not sure it&#8217;s a bug you may want to discuss the issue in the <a href="http://crowdfavorite.com/forums/">forums</a> first to confirm.</p>
<p>If the bug is security related, please <a href="http://crowdfavorite.com/contact/">contact us directly</a> instead of posting it publicly.</p>
]]></content:encoded>
			<wfw:commentRss>http://text.carringtontheme.com/2009/08/carrington-framework-qa-part-2/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Carrington Core 2.5</title>
		<link>http://text.carringtontheme.com/2009/08/carrington-core-2-5/</link>
		<comments>http://text.carringtontheme.com/2009/08/carrington-core-2-5/#comments</comments>
		<pubDate>Sun, 16 Aug 2009 18:53:12 +0000</pubDate>
		<dc:creator>Alex King</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://carringtontheme.com/?p=350</guid>
		<description><![CDATA[We&#8217;ve released a new version of the Carrington Core &#8211; the engine that powers the Carrington framework. This version has two notable changes:

A fix for a logical bug in the context detection function &#8211; now properly selects the &#8220;home&#8221; context in some cases where it didn&#8217;t previously.
The addition of a filter to allow the available [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve released a new version of the Carrington Core &#8211; the engine that powers the Carrington framework. This version has two notable changes:</p>
<ol>
<li>A fix for a logical bug in the context detection function &#8211; now properly selects the &#8220;home&#8221; context in some cases where it didn&#8217;t previously.</li>
<li>The addition of a filter to allow the available files to be provided by code rather than looking at directory contents.</li>
</ol>
<p>If you wish to upgrade a Carrington-based theme to the latest core, you can do so by just replacing the &#8220;carrington-core&#8221; directory.</p>
<p>Get the Carrington Core 2.5 release from the public SVN directory:</p>
<p>http://carrington.googlecode.com/svn/framework/tags/2.5</p>
]]></content:encoded>
			<wfw:commentRss>http://text.carringtontheme.com/2009/08/carrington-core-2-5/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>The Post Context</title>
		<link>http://text.carringtontheme.com/2009/08/the-post-context/</link>
		<comments>http://text.carringtontheme.com/2009/08/the-post-context/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 11:32:41 +0000</pubDate>
		<dc:creator>Alex King</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://carringtontheme.com/?p=319</guid>
		<description><![CDATA[This describes the Post Context, a concept in the Carrington CMS theme framework for WordPress. Before reading this, you should read the Q&#038;A and the Framework Overview.
In this article we will review some real world examples and cover how the Post Context works and where it is used. The Post Context allows you to customize [...]]]></description>
			<content:encoded><![CDATA[<p><i>This describes the Post Context, a concept in the Carrington CMS theme framework for WordPress. Before reading this, you should read the <a href="http://carringtontheme.com/2009/08/what-is-carrington-the-qa/">Q&#038;A</a> and the <a href="http://carringtontheme.com/2009/08/framework-overview/">Framework Overview</a>.</i></p>
<p>In this article we will review some real world examples and cover how the Post Context works and where it is used. The Post Context allows you to customize how posts are shown based on information about the post and the post author.</p>
<h3>Scenario #1 &#8211; Twitter Posts</h3>
<p>A common feature in blogs these days is the custom display of a post based on some information about the post, like what category the post is in. Using a plugin like Twitter Tools, you can bring in your tweets from Twitter as blog posts in WordPress.</p>
<p>These posts are different than your other blog posts, and you&#8217;d like to style them accordingly. Carrington was built for this.</p>
<p>We&#8217;ll assume that the Twitter posts all have a Twitter category attached to them (alternatively you could use tags or post meta instead if you wanted to &#8211; Carrington supports these as well). Normally to make these posts look different, you&#8217;d add some code into your loop that checks if the post is in the Twitter category, then shows different HTML accordingly. With Carrington, it&#8217;s much simpler.</p>
<p>Create a new template named cat-twitter.php in the content/ directory and when a post is displayed that is in the Twitter category, it will use this template instead. You can edit the HTML for this template to remove the title, the category and tag list &#8211; maybe add a little Twitter icon or similar to it and a link to your Twitter page.</p>
<p>It&#8217;s that easy &#8211; you don&#8217;t have to know how to write the conditional PHP code to make it happen. With Carrington, this level of customization is comfortably extended to the domain of designers.</p>
<h3>Scenario #2 &#8211; Columnists</h3>
<p>When creating news/magazine sites it&#8217;s pretty common to have a &#8220;columnist&#8221; feature that you need to support. This means that certain authors need to be treated specially. For example, let&#8217;s say I&#8217;m building a WordPress content site and we have Matt Mullenweg writing a monthly column. We&#8217;ll want to give these articles a special treatment so that they stand out visually from the other posts on the site. With Carringon, this is easy.</p>
<p>To create a template that is used for Matt&#8217;s pieces, we simply create a user-matt.php file (this assumes Matt&#8217;s username is &#8220;matt&#8221;) in the content/ folder that shows a nice headshot of Matt at the top, and some musical notes (a nod to his love of jazz) sprinkled along the bottom of the post. Now whenever that post is shown, Carrington will find the Matt template and use that instead of the standard template.</p>
<p>If you also want to highlight these posts when showing the post excerpt, that&#8217;s just as easy. Create a user-matt.php file in the excerpt/ folder with Matt&#8217;s headshot included and it will use that whenever the post excerpt is shown.</p>
<p>Again, Carrington&#8217;s power brings you easy customization and flexibility without needing to write any PHP code. The same approach can be used for user groups as well &#8211; Carrington supports WordPress roles (editor, contributor, etc.) and named templates for these roles.</p>
<h3>Scenario #3 &#8211; Google Maps</h3>
<p>Attaching additional information to a post is another common need when creating a WordPress as a CMS web site. Carrington makes it easy to use this information to change the display of posts.</p>
<p>On your WordPress powered site you have posts that need to include Google Maps. The Google Map information is stored in a custom field called &#8220;gmap&#8221; and you want to display the Google Map for these posts.</p>
<p>I think you know what&#8217;s coming next. With Carrington you can simply create a meta-gmap.php file in the content/ directory that includes the necessary code to embed your Google Map using the data in your custom field.</p>
<p>Again, no need for conditional PHP code in your theme for this &#8211; simply create your template and let Carrington take care of using it for you.</p>
<h3>Scenario #4 &#8211; Featured Posts</h3>
<p>The above example is perfect for situations where you want to do something based on the key of the custom field. Carrington also supports templates based on both the key and value of the custom field.</p>
<p>Another custom field you might want to support is a &#8220;featured post&#8221; field &#8211; perhaps you want to make sure that your featured post template is only used when there is a custom field with a key of &#8220;featured&#8221; and a value of &#8220;yes&#8221;. It&#8217;s easy with Carrington, you just create a file named meta-featured-yes.php in your content/ directory and Carrington will choose that file for these posts.</p>
<p>I hope this illustrates how Carrington allows you to use custom templates instead of conditional code to customize the way post content is displayed in your theme.</p>
<h2>Post Context Documentation</h2>
<p>When choosing a template to use in the Post Context, the Carrington engine looks information (author, category, tags, custom fields, etc.) related to the post/page being shown.</p>
<p>Commonly these templates are included by templates in the _loop/_; but are also useful for bringing in an atomic post representation via AJAX or placing one within another template.</p>
<p>A &#8220;default&#8221; template is required, and will be used when there are no other templates that match a given post. This could be because no other templates have been created, or because the post in question doesn&#8217;t match the templates that are available.</p>
<p>You can create templates to be used with posts/pages given various conditions. For example, you might want to give all posts in a certain category some specific styling rules. Or perhaps posts with a certain custom field or by a specific author. This is accomplished by creating templates with file names that match these conditions, then placing them in the _content/_ directory. All templates other than _{dirname}-default.php_ are optional.</p>
<p>The order in which these conditions are checked defaults to the following:</p>
<ol>
<li>author</li>
<li>meta</li>
<li>category</li>
<li>role</li>
<li>tag</li>
<li>parent</li>
<li>default</li>
</ol>
<p>however this order can be overridden with a plugin using the `cfct_single_match_order` hook.</p>
<p>Once a template match has been found, no other processing is done.</p>
<h3>Supported Templates (Post Context)</h3>
<ul>
<li><b>{dirname}-default.php</b> &#8211; Used when there are no other templates that match for a given post/page.</li>
<li><b>author-{username}.php</b> &#8211; Used when a user with that username authors a post/page. For example, a template with a file name of <code>author-jsmith.php</code> would be used for a poat/page by user <code>jsmith</code>. Any WordPres username can take the place of {username} in the file name.</li>
<li><b>cat-{slug}.php</b> &#8211; Used when a post is in a given category. The category is matched by the &#8220;slug&#8221; &#8211; for example a post in category &#8220;General&#8221; (with a category slug of &#8220;general&#8221;) could use a template of <code>cat-general.php</code>.</li>
<li><b>meta-{key}.php</b> &#8211; Used when there is a custom field for the post/page matching the key listed in the file name. This is useful if you want to be able to flag posts as &#8220;photo&#8221; or similar, and give those posts some custom treatment. In this example, you could add a custom field of &#8220;photo&#8221; with a value of the URL of the image to a post/page and it would use a template of <code>meta-photo.php</code> if that template exists. The value does not matter in this match.</li>
<li><b>meta-{key}-{value}.php</b> &#8211; Used when there is a custom field for the post/page matching the key and value listed in the file name. This is useful if you want to be able to flag posts as &#8220;featured&#8221; or similar, and give those posts some custom treatment. In this example, you could add a custom field of &#8220;featured&#8221; with a value of &#8220;yes&#8221; to a post/page and it would use a template of <code>meta-featured-yes.php</code> if that template exists.</li>
<li><b>page.php</b> &#8211; Used when the content is being displayed is a page (not a post).</li>
<li><b>parent-{slug}.php</b> &#8211; Used when a page is a child page of a specific parent page. The page is matched by the &#8220;slug&#8221; &#8211; for example a page under a parent page with slug of &#8220;example&#8221; could use a template of <code>parent-example.php</code>.</li>
<li><b>role-{role}.php</b> &#8211; Used when a post/page is authored by a user with a particular role. The {role} is an all lowercase representation of the role string &#8211; for example, an author with an &#8220;Administrator&#8221; role might use a template of <code>role-administrator.php</code>. This is primarily useful if you have a set of authors that are given a Contributor role; or a Guest Columnist role or similar. Any WordPress role can take the place of {role} in the file name.</li>
<li><b>tag-{slug}.php</b> &#8211; Used when a post has a certain tag applied to it. The tag is matched by the &#8220;slug&#8221; &#8211; for example a post with tag &#8220;Reference&#8221; (with a tag slug of &#8220;reference&#8221;) could use a template of <code>tag-reference.php</code>.</li>
</ul>
<p>Create templates with names using these patterns and place them into the directories (content, excerpt) that use the Post Context. The templates will be used when a situation arises matching their named condition.</p>
<p>This has been an overview of the Post Context of the Carrington CMS theme framework for WordPress. You may want to take a look at the <a href="http://carringtontheme.com/2009/08/the-general-context/">General Context</a> and the <a href="http://carringtontheme.com/2009/08/the-comment-context/">Comment Context</a> next.</p>
<p>Community additions to the documentation and resources for Carrington (including this page) are very welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://text.carringtontheme.com/2009/08/the-post-context/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>The Comment Context</title>
		<link>http://text.carringtontheme.com/2009/08/the-comment-context/</link>
		<comments>http://text.carringtontheme.com/2009/08/the-comment-context/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 03:45:07 +0000</pubDate>
		<dc:creator>Alex King</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://carringtontheme.com/?p=321</guid>
		<description><![CDATA[This describes the Comment Context, a concept in the Carrington CMS theme framework for WordPress. Before reading this, you should read the Q&#038;A and the Framework Overview.
In this article we will review some real world examples and cover how the Comment Context works and where it is used. The Comment Context allows you to customize [...]]]></description>
			<content:encoded><![CDATA[<p><i>This describes the Comment Context, a concept in the Carrington CMS theme framework for WordPress. Before reading this, you should read the <a href="http://carringtontheme.com/2009/08/what-is-carrington-the-qa/">Q&#038;A</a> and the <a href="http://carringtontheme.com/2009/08/framework-overview/">Framework Overview</a>.</i></p>
<p>In this article we will review some real world examples and cover how the Comment Context works and where it is used. The Comment Context allows you to customize how comments are shown based on information about the comment and the person who left the comment.</p>
<h3>Scenario #1 &#8211; Registered Users</h3>
<p>On a site that wants to encourage our visitors to register, giving registered users enhanced comment displays is a nice approach to take. Perhaps the standard comment display shows just the commentor&#8217;s name, but a comment by a registered user shows their name, a link to their web site, a photo, etc.</p>
<p>Accomplishing this with Carrington is very simple. You don&#8217;t have to write any conditional PHP code, you can simply create a new comment template and Carrington will do the rest.</p>
<p>Assuming registered users have a role of &#8220;Subscriber&#8221;, we create a template file named role-subscriber.php and place it in the comment/ folder. In that template file you include the HTML for the links, etc. that you want to display for your registered users. Carrington will use that file for comments by registered users.</p>
<h3>Scenario #2 &#8211; Pingbacks</h3>
<p>You may want to have custom displays for pingback and trackback comments to differentiate them from other comments. Perhaps you want to display a small screenshot of the page that has sent the pingback to your post.</p>
<p>Doing this custom display is easy with Carrington. Simply create a ping.php file in the comment/ directory, and place the HTML and associated code for the web site thumbnail into that template. When displaying a comment that is a pingback or a trackback, Carrington will use this template file &#8211; showing your site thumbnail as well.</p>
<p>No need to inline conditional PHP code in your template, just create templates for the conditions you care about and the Carrington engine will take care of the rest.</p>
<h3>Scenario #3 &#8211; Celebrities</h3>
<p>If you are running a site in which certain individuals are very important, you may want to take advantage of the Carrington feature which allows you to create custom comment templates on a per-user basis.</p>
<p>If you are running a U2 fan site and Bono drops by to leave a comment, you probably want to highlight that comment. To do this, simply create a user-bono.php template (where &#8220;bono&#8221; is the username) in the comment/ folder and that template will be used for comments by Bono.</p>
<p>This feature can also be useful to distinguish real comments by a particular user from comments by someone else with (or using) the same name.</p>
<p>As you can see, Carrington makes it really easy to create custom comment displays for different situations without writing any conditional PHP code.</p>
<h2>Comment Context Documentation</h2>
<p>When choosing a template to use in the Comment Context, the Carrington engine looks at the type of comment and the author of the comment to choose which template to use.</p>
<p>A &#8220;default&#8221; template is required, and will be used when there are no other templates that match a given comment. This could be because no other templates have been created, or because the comment in question doesn&#8217;t match the templates that are available.</p>
<p>The order in which these conditions are checked defaults to the following:</p>
<ol>
<li>ping</li>
<li>author</li>
<li>user</li>
<li>role</li>
<li>default</li>
</ol>
<p>however this order can be overridden with a plugin using the `cfct_comment_match_order` hook.</p>
<p>Once a template match has been found, no other processing is done.</p>
<h3>Supported Templates (Comment Context)</h3>
<ul>
<li><b>comment-default.php</b> &#8211; Used when there are no other templates that match for a given comment.</li>
<li><b>ping.php</b> &#8211; Used if the comment is a pingback or a trackback.</li>
<li><b>author.php</b> &#8211; Used when the author of the post leaves a comment.</li>
<li><b>user-{username}.php</b> &#8211; Used when a user with that username leaves a comment. For example, a template with a file name of <code>user-jsmith.php</code> would be used for a comment by user <code>jsmith</code>. Any WordPres username can take the place of {username} in the file name.</li>
<li><b>role-{role}.php</b> &#8211; Used when a comment is made by a user with a certain role. For example, a template with a file name of <code>role-subscriber.php</code> would be used for a user with a role of &#8220;subscriber&#8221; (typical for a registered commentor who is not an author or an admin). Any WordPress role can take the place of {role} in the file name.</li>
</ul>
<p>Create templates with names using these patterns and place them into the directories (comment) that use the Comment Context. The templates will be used when a situation arises matching their named condition.</p>
<p>This has been an overview of the Comment Context of the Carrington CMS theme framework for WordPress. You may want to look at the <a href="http://carringtontheme.com/2009/08/the-general-context/">General Context</a> and <a href="http://carringtontheme.com/2009/08/the-post-context/">Post Context</a> next.</p>
<p>Community additions to the documentation and resources for Carrington (including this page) are very welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://text.carringtontheme.com/2009/08/the-comment-context/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>The General Context</title>
		<link>http://text.carringtontheme.com/2009/08/the-general-context/</link>
		<comments>http://text.carringtontheme.com/2009/08/the-general-context/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 03:43:07 +0000</pubDate>
		<dc:creator>Alex King</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://carringtontheme.com/?p=304</guid>
		<description><![CDATA[This describes the General Context, a concept in the Carrington CMS theme framework for WordPress. Before reading this, you should read the Q&#038;A and the Framework Overview.
In this article we will review some real world examples and cover how the General Context works and where it is used. The General Context allows you to customize [...]]]></description>
			<content:encoded><![CDATA[<p><i>This describes the General Context, a concept in the Carrington CMS theme framework for WordPress. Before reading this, you should read the <a href="http://carringtontheme.com/2009/08/what-is-carrington-the-qa/">Q&#038;A</a> and the <a href="http://carringtontheme.com/2009/08/framework-overview/">Framework Overview</a>.</i></p>
<p>In this article we will review some real world examples and cover how the General Context works and where it is used. The General Context allows you to customize how general parts of your theme (header, footer, sidebar, etc.) are shown based on information about the type of page being shown.</p>
<h3>Scenario #1 &#8211; Custom Sidebar</h3>
<blockquote><p>You&#8217;re building a personal web site/blog. One of your categories is &#8220;Photos&#8221;, a place where you post some of your photos and perhaps some of your thoughts on photography. For this section, you want to add a little something extra to your sidebar &#8211; you want to include your most recent photo, a Flickr slideshow, etc. at the top of the sidebar.</p></blockquote>
<p>Using Carrington, this is very simple. You create a new file in your sidebar/ folder called cat-photos.php and Carrington will use this sidebar when showing the category archives for the Photos category.</p>
<p>If you want also use a custom sidebar template for any single post in this category, you can create another template in the sidebar/ directory called single-cat-photos.php. This template will be used for single post views when the post is in the Photos category.</p>
<p>Bingo, you&#8217;ve got a custom sidebar that is only used when you want it.</p>
<p>Now you may be thinking &#8220;Wait a minute, what about code duplication? I thought that was bad&#8230;&#8221; &#8211; you&#8217;re right. However multiple templates doesn&#8217;t necessarily mean code duplication. Remember this is all just PHP, you can put your common code in a file called common.php or similar and include that in each sidebar file. Perhaps that file is showing a dynamic sidebar if you&#8217;re using dynamic sidebars and widgets. In the scenario above, you might simply include the cat-photos.php file in the single-cat-photos.php file.</p>
<p>Can you do this with conditional code in a single template? Sure. What Carrington gives you two-fold: is a consistent way to manage all of these conditions using simple named templates and the ability to make this change without writing any PHP code (designer friendly!). Also, this is just very a simple example, the more complex the site you are building, the more Carrington will help you out.</p>
<h3>Scenario #2 &#8211; Custom Headers</h3>
<blockquote><p>You&#8217;re building a magazine web site that uses custom header graphics and elements for different categories and author archives. The headers include custom elements like live scores in the Sports category, weather conditions in the Weather category, and a headshot and mini-bio for the author archives.</p></blockquote>
<p>In this example, you can see how the conditional code in header.php would start to get fairly complex in a traditional WordPress theme.</p>
<p>The files you would create in this scenario are: cat-sports.php, cat-weather.php, author-jsmith.php, authorsjones.php, etc.</p>
<p>In each file put in the HTML, PHP function calls, etc. for the content you need for that category or author archive. Remember, you can include common code into each of these templates from a separate common template if necessary.</p>
<h2>General Context Documentation</h2>
<p>The Carrington framework enables customizability based on matching contexts and file templates that conform to the Carrington template naming conventions.</p>
<p>The General Context refers to type of page that is being shown. This context is used when selecting a template from the following directories:</p>
<ul>
<li>attachment</li>
<li>comments</li>
<li>footer</li>
<li>header</li>
<li>loop</li>
<li>posts</li>
<li>sidebar</li>
<li>single</li>
</ul>
<p>When choosing a template to use in the General Context, the Carrington engine looks at the type of request is being fulfilled. It will identify the request as the home page, a category archive, and individual post, etc.</p>
<p>There is additional checking done for single post requests. All options in the Content Context are supported here with a &#8217;single-&#8217; prefix added to the file. See specifics below.</p>
<p>A &#8220;default&#8221; template is required, and will be used when there are no other templates that match a given comment. This could be because no other templates have been created, or because the comment in question doesn&#8217;t match the templates that are available.</p>
<p>By default, conditions are checked in this order:</p>
<ol>
<li>author</li>
<li>role</li>
<li>category</li>
<li>tag</li>
<li>single</li>
<li>default (home, search, archive, 404, etc.)</li>
</ol>
<p>This order can be altered (and added to) using the `cfct_general_match_order` filter.</p>
<h3>Supported Templates (General Context)</h3>
<ul>
<li><b>{dirname}-default.php</b> (or default.php) &#8211; Used when there are no other templates that match for a given page/post.</li>
<li><b>archive.php</b> &#8211; Used for date archives or if there are no specific category, author or tag templates.</li>
<li><b>author.php</b> &#8211; Used for author archive lists.</li>
<li><b>author-{username}.php</b> &#8211; Used when the post/page is authored by a specific user. For example, a template with a file name of <code>author-jsmith.php</code> would be used for a post/page by user <code>jsmith</code>. Any WordPress username can take the place of {username} in the file name.</li>
<li><b>role-{rolename}.php</b> &#8211; Used when the post author has a particular role. This might be the role of <code>contributor</code>, <code>author</code>, <code>editor</code>, etc. and use a file of <code>role-contributor.php</code>, <code>role_author.php</code>, etc. where the role name takes the place of the {rolename} in the file name.</li>
<li><b>category.php</b> &#8211; Used for category archive lists.</li>
<li><b>cat-{slug}.php</b> &#8211; Used fr displaying a given category. The category is matched by the &#8220;slug&#8221; &#8211; for example a post in category &#8220;General&#8221; (with a category slug of &#8220;general&#8221;) could use a template of <code>cat-general.php</code>.</li>
<li><b>home.php</b> &#8211; Used when on the home page.</li>
<li><b>page.php</b> &#8211; Used for pages that do not match any other contextual templates.</li>
<li><b>search.php</b> &#8211; Used when displaying search results.</li>
<li><b>single.php</b> &#8211; Used for single post pages.</li>
<li><b>single-{content context filenames}.php</b> &#8211; Used for single post pages.</li>
<li><b>tag.php</b> &#8211; Used for tag archive lists.</li>
<li><b>tag-{slug}.php</b> &#8211; Used for displaying a given tag. The tag is matched by the &#8220;slug&#8221; &#8211; for example a post in tag &#8220;News&#8221; (with a tag slug of &#8220;news&#8221;) could use a template of <code>tag-news.php</code>.</li>
</ul>
<p>Create templates with names using these patterns and place them into the directories that use the General Context. The templates will be used when a situation arises matching their named condition.</p>
<p>This has been an overview of the General Context of the Carrington CMS theme framework for WordPress. You may want to look at the <a href="http://carringtontheme.com/2009/08/the-post-context/">Post Context</a> and <a href="http://carringtontheme.com/2009/08/the-comment-context/">Comment Context</a> next.</p>
<p>Community additions to the documentation and resources for Carrington (including this page) are very welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://text.carringtontheme.com/2009/08/the-general-context/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Carrington Framework Overview</title>
		<link>http://text.carringtontheme.com/2009/08/framework-overview/</link>
		<comments>http://text.carringtontheme.com/2009/08/framework-overview/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 20:21:49 +0000</pubDate>
		<dc:creator>Alex King</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://carringtontheme.com/?p=287</guid>
		<description><![CDATA[This post covers the basic similarities and differences between a Carrington theme and a traditional WordPress theme, and the core functionality of the Carrington CMS theme framework. Please read the Q&#38;A first before reading this overview.
Themes created with the Carrington framework work much in the way a traditional WordPress theme does, the difference is in [...]]]></description>
			<content:encoded><![CDATA[<p><i>This post covers the basic similarities and differences between a Carrington theme and a traditional WordPress theme, and the core functionality of the Carrington CMS theme framework. Please read the <a href="http://carringtontheme.com/2009/08/what-is-carrington-the-qa/">Q&amp;A</a> first before reading this overview.</i></p>
<p>Themes created with the Carrington framework work much in the way a traditional WordPress theme does, the difference is in how the code is abstracted and what can be done with those abstractions. The initial response when seeing more files and folders in a Carrington theme seems to be &#8220;wow, this is complicated&#8221;, but the general process is no different than a traditional WordPress theme.</p>
<p>Here is a diagram that shows the difference between the page load for a single post view in the WordPress Default theme and how the same in done in Carrington:</p>
<p><img src="http://carringtontheme.com/wp/wp-content/uploads/2009/08/flow.png" alt="flow" title="flow" width="500" height="630" class="aligncenter size-full wp-image-289" /></p>
<p>In this diagram, the items in bubbles are pulled in as included files and the items without bubbles are hardcoded into a parent file.</p>
<p>As you can see, the same things are loaded in the same order. If you dig in and look at the code, you&#8217;ll see that the same WordPress template functions are used in both. The difference is in how the template files are structured.</p>
<p>The WordPress Default theme basically follows this code path:</p>
<ul>
<li>Load single.php</li>
<li>single.php includes header.php</li>
<li>&#8220;the loop&#8221; is hardcoded into single.php</li>
<li>&#8220;the content&#8221; is hardcoded into &#8220;the loop&#8221; portion of single.php</li>
<li>single.php includes comments.php, which displays the list of comments and the add comment form</li>
<li>single.php includes sidebar.php</li>
<li>single.php includes footer.php</li>
</ul>
<p>You&#8217;ll note that code is hardcoded into single.php and comments.php. This prevents you from re-using that code in other places in the theme the way that more atomic templates for these items would.</p>
<p>Now let&#8217;s look at the code path for a Carrington theme:</p>
<ul>
<li>Load single.php</li>
<li>single.php asks the Carrington framework to look for appropriate top page templates in the single/ directory and includes the proper template.</li>
<li>Next we include a header file &#8211; the Carrington framework looks for an appropriate header templates in the header/ directory and includes it.</li>
<li>The next include is a loop from the loop/ directory &#8211; again, selected from available templates by the Carrington framework.</li>
<li>The loop include will then choose either a full content view of the post from the content/ directory or an abbreviated view from the excerpt/ directory. The template is selected by the Carrington framework based on the available templates and the various data attributes of the post.</li>
<li>The next include is the comments wrapper from the comments/ directory, again chosen as appropriate by the Carrington framework from available template options for the current page.</li>
<li>The comments wrapper holds the comments loop, which then includes the appropriate comment template for each comment from available templates in the comment/ directory.</li>
<li>The comment form is brought in from the forms/ directory &#8211; having it separate makes it available for re-use in other places as needed.</li>
<li>The sidebar is selected by the Carrington framework from available sidebar templates in the sidebar/ directory.</li>
<li>The footer is selected by the Carrington framework from available footer templates in the footer/ directory.</li>
</ul>
<p>There appear to be more steps in this process, but if you look you&#8217;ll see they are the same steps that are in the WordPress Default theme. There are more files and folders because we&#8217;ve taken care to better abstract the distinct bits and pieces of the theme into discreet atomic templates; enabling better re-use of them.</p>
<p>Duplicating code is bad. Developers know this, it&#8217;s why they create functions, objects, include files, etc. to avoid having to maintain the same code in multiple places. Designers know it too. It&#8217;s why they create CSS stylesheets instead of hardcoding CSS into style tags for every element. Carrington is built from the ground up around native support for atomic templates for various WordPress theme components (to encourage and enable code re-use).</p>
<p>In the Carrington Blog theme, we use the atomic post templates to be able to load in posts individually from the archive pages with AJAX &#8211; see an example <a href="http://blog.carringtontheme.com/category/announcements/">here</a>. This isn&#8217;t easily possible with the WordPress Default theme because the template code for the individual post isn&#8217;t abstracted into a separate file.</p>
<p>Above in the page load process I talk about the Carrington framework choosing from available templates for each piece of the theme. This smart template selection is the primary job of the Carrington framework. It allows you to create rich, customized themes for complex CMS web sites by simply creating different template files instead of coding conditional logic into your template files.</p>
<p><b>You create templates for various conditions, and the Carrington framework uses those templates when it runs across one of those conditions.</b></p>
<p>It&#8217;s also important to note that you don&#8217;t <em>have</em> to create more than one template for anything. You could start your site with just default templates in each folder, and have the ability to expand with easy customization later.</p>
<p>The templates in the different Carrington directories are chosen based on one of three supported contexts:</p>
<ol>
<li>General Context &#8211; what type of page is this (category page, single page, home page, etc.)?</li>
<li>Post Context &#8211; what type of post is this (does it have this category, author, tag, custom field, etc.)?</li>
<li>Comment Context &#8211; what type of comment is this and who left it (comment, pingback, is the user registered, an author, etc.)?</li>
</ol>
<p>Note: these contexts can be extended and additional data conditions to check can be added using the hooks and filters in the core Carrington framework.</p>
<p>For example, when choosing the template file to use for the header, the process looks something like this:</p>
<ol>
<li>Check for available template files in the header/ directory.</li>
<li>Run through conditions from most restrictive to most liberal (the order and conditions are customizable via filter) until a match is found with a template option. When a match is found, use that template.</li>
<li>Use the default template if there is no match found to a condition, or no other templates are present.</li>
</ol>
<p>Each folder in the Carrington themes we provide (including Carrington JAM, our &#8220;starting point&#8221; theme) includes a README file that explains the purpose of the files in that folder, what context is supported for that folder, and what template naming conventions are supported in that folder by the Carrington framework.</p>
<p>Hopefully this overview has given you a good base from which to understand the core principles in place in Carrington, and how it is similar and different from traditional WordPress theming. In our next installment, we&#8217;ll look at the General Context and how to use it.</p>
]]></content:encoded>
			<wfw:commentRss>http://text.carringtontheme.com/2009/08/framework-overview/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>
