<?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>Two Thirds Design &#187; Article</title>
	<atom:link href="http://www.twothirdsdesign.co.uk/category/article/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.twothirdsdesign.co.uk</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Wed, 01 Feb 2012 11:27:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Raising the Barr</title>
		<link>http://www.twothirdsdesign.co.uk/article/2011/04/raising-the-barr/</link>
		<comments>http://www.twothirdsdesign.co.uk/article/2011/04/raising-the-barr/#comments</comments>
		<pubDate>Mon, 04 Apr 2011 14:07:58 +0000</pubDate>
		<dc:creator>gill</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[Tech Stuff]]></category>
		<category><![CDATA[Work In Progress]]></category>

		<guid isPermaLink="false">http://www.twothirdsdesign.co.uk/?p=633</guid>
		<description><![CDATA[The restoration of Barr Beacon’s historic features and community pride. We’ve been a bit quiet on our blog posts of late, the main reason being that at the Two Thirds office we’ve been heads down helping out Jeff McBride, Countryside Project Development Officer from Walsall Council with an exciting new Heritage Lottery Funding application. This [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.twothirdsdesign.co.uk/content/uploads/2011/04/Barr-Beacon_blog.jpg"><img src="http://www.twothirdsdesign.co.uk/content/uploads/2011/04/Barr-Beacon_blog.jpg" alt="Barr Beacon Raising the Barr" title="Barr-Beacon_blog" width="177" height="251" class="alignleft size-full wp-image-634" /></a></p>
<p><strong>The restoration of Barr Beacon’s historic features and community pride.</strong></p>
<p>We’ve been a bit quiet on our blog posts of late, the main reason being that at the Two Thirds office we’ve been heads down helping out Jeff McBride, Countryside Project Development Officer from Walsall Council with an exciting new Heritage Lottery Funding application. This could mean exciting changes to Barr Beacon over the coming couple of years, involving the public with all sorts of exciting events using new technologies. We’ve provided Jeff with research into development of multi-platform educational resources, public consultation and information gathering solutions along with a white paper on the suitability a mobile interactive application.</p>
<p></p>
<p>So watch this space for progress updates…</p>
]]></content:encoded>
			<wfw:commentRss>http://www.twothirdsdesign.co.uk/article/2011/04/raising-the-barr/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Feast &#8211; new web site launched!</title>
		<link>http://www.twothirdsdesign.co.uk/article/2011/04/the-feast-new-web-site-launched/</link>
		<comments>http://www.twothirdsdesign.co.uk/article/2011/04/the-feast-new-web-site-launched/#comments</comments>
		<pubDate>Mon, 04 Apr 2011 13:59:54 +0000</pubDate>
		<dc:creator>gill</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[Tech Stuff]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://www.twothirdsdesign.co.uk/?p=619</guid>
		<description><![CDATA[We’ve been working recently with Tim Fawssett, Project Manager from The Feast and we’re happy to announce their brand new fully customised WordPress site. The Feast is a Christian charity based in Birmingham in the UK, working to promote Community Cohesion between Christian and Muslim young people.We’ve worked with The Feast on a few projects [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_632" class="wp-caption alignleft" style="width: 310px"><a href="http://www.twothirdsdesign.co.uk/content/uploads/2011/04/feast_blog1.jpg"><img class="size-medium wp-image-632" title="feast_blog" src="http://www.twothirdsdesign.co.uk/content/uploads/2011/04/feast_blog1-300x204.jpg" alt="The Feast new web site" width="300" height="204" /></a><p class="wp-caption-text">The Feast new web site</p></div>
<p>We’ve been working recently with Tim Fawssett, Project Manager from <strong>The Feast</strong> and we’re happy to announce their brand new fully customised WordPress site.</p>
<p>The Feast is a Christian charity based in Birmingham in the UK, working to promote Community Cohesion between Christian and Muslim young people.We’ve worked with The Feast on a few projects to date, and it’s been a good collaborative and creative process establishing a new, strong, brand for them. We have worked closely with Tim to completely re-brand and re-structure their site andTim has thrown himself into fully using and understanding the WordPress technology. It’s been a pleasure to work with The Feast and we are happy that they are getting great feedback on their new site.</p>
<p>Please take a look, sign up to their newsletter or consider doing some volunteering!</p>
<p><a href="http://www.thefeast.org.uk/" target="_blank">www.thefeast.org.uk</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.twothirdsdesign.co.uk/article/2011/04/the-feast-new-web-site-launched/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setting templates for WordPress 3.0 Custom Post Type</title>
		<link>http://www.twothirdsdesign.co.uk/article/2010/03/setting-templates-for-wordpress-3-0-custom-post-type/</link>
		<comments>http://www.twothirdsdesign.co.uk/article/2010/03/setting-templates-for-wordpress-3-0-custom-post-type/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 16:06:26 +0000</pubDate>
		<dc:creator>Geraint</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[post]]></category>
		<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[WP3.0]]></category>

		<guid isPermaLink="false">http://www.twothirdsdesign.co.uk/?p=527</guid>
		<description><![CDATA[Since WP2.9 WordPress has had the ability to declare custom post types.  However, up until now you have had to build your own backend UI to manage those posts.  Now in the up coming 3.0 version WordPress can provide that too almost automatically, theres a great tutorial at wpengineer.com  http://wpengineer.com/impressions-of-custom-post-type/ that shows you how to add a custom post [...]]]></description>
			<content:encoded><![CDATA[<p>Since WP2.9 WordPress has had the ability to declare custom post types.  However, up until now you have had to build your own backend UI to manage those posts.  Now in the up coming 3.0 version WordPress can provide that too almost automatically, theres a great tutorial at wpengineer.com  <a href="http://wpengineer.com/impressions-of-custom-post-type/">http://wpengineer.com/impressions-of-custom-post-type/</a> that shows you how to add a custom post type and what  options are available.</p>
<p>Anyway today I set about exploring 3.0 alpha 1 and had a mess with custom posts, and immediately decided it would have saved days of work when building this site alone, but what I couldn&#8217;t figure out was how to customise the display of my custom posts, after a few searches I came across someone  in the WP.org forums with the same problem and no answers.</p>
<p>So I did some digging in the 3.0 code to figure out what template was getting used, and how it was getting chosen.  After an hour or so looking at the WP_Query class, and the theme.php file in the core I came up with a simple  and more advanced solution.</p>
<h3>Simple Solution</h3>
<p>Its build in, just not documented, atleast anywhere I could find.  The template used for a custom post view is decided by the &#8216;get_single_template()&#8217; function in the wp-includes/theme.php file.  And it basically tells locate_template() to look for single-&#8217;post_type&#8217;.php or single.php.</p>
<p>So the simplest way to customise the way a custom post is displayed is to add a template file to your theme with the name single-xxxxxx.php</p>
<h3>Advanced Solution</h3>
<p>Anyway that solution worked but what if you want to do other stuff like single out a specific custom post by id, or anything.</p>
<p>Well a bit more reverse engineering and I came up with a solution.  First I wrote a simple is_ funtion for my custom post type &#8216;publication&#8217;, that way I could test for them.</p>
<pre><code>function is_publication() { $post_type = get_query_var('post_type'); // short had for if / else; return $post_type == 'publication' ? true : false; }</code></pre>
<p>Then I added my own get_xxx_template function to choose which template file to load including publication-id.php and fallback to single.php if none is found.</p>
<pre><code>function get_publication_template() { global $wp_query; $object = $wp_query-&gt;get_queried_object(); $templates = array( 'publication-'. $object-&gt;ID .'.php', 'publication.php', 'single-'. $object-&gt;post_type .'.php', 'single.php' ); $page_template = get_post_meta( $object-&gt;ID , '_wp_page_template', true ); if ( !empty( $page_template ) ) { $templates = array( $page_template ) + $templates; } return locate_template( $templates ); } </code></pre>
<p>Finally I added a function to use the  &#8217;template_inlcude&#8217; filter hook.  It uses is_publication to check if the publication templates need to be loaded, and if so replaces/filters the template being loaded with the template determined by my get_publication_template function.</p>
<pre><code> function set_publication_template( $template ) { if ( is_publication() ) { $template = get_publication_template(); } return $template; } add_filter('template_include', 'set_publication_template'); </code></pre>
<p>And Finally the code in full including declaration.</p>
<pre><code> function ttd_post_type_publication() { register_post_type( 'publication', array( 'label' =&gt; __('Publications'), 'public' =&gt; true, 'show_ui' =&gt; true, 'supports'=&gt; array( 'post-thumbnails', 'excerpts', 'custom-fields', 'comments' ) ) ); register_taxonomy_for_object_type('post_tag', 'publication'); } function is_publication() { $post_type = get_query_var('post_type'); // short had for if / else; return $post_type == 'publication' ? true : false; } function get_publication_template() { global $wp_query; $object = $wp_query-&gt;get_queried_object(); $templates = array( 'publication-'. $object-&gt;ID .'.php', 'publication.php', 'single-'. $object-&gt;post_type .'.php', 'single.php' ); $page_template = get_post_meta( $object-&gt;ID , '_wp_page_template', true ); if ( !empty( $page_template ) ) { $templates = array( $page_template ) + $templates; } return locate_template( $templates ); } function set_publication_template( $template ) { if ( is_publication() ) { $template = get_publication_template(); } return $template; } add_filter('template_include', 'set_publication_template'); add_action('init', 'ttd_post_type_publication');</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.twothirdsdesign.co.uk/article/2010/03/setting-templates-for-wordpress-3-0-custom-post-type/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
	</channel>
</rss>

