<?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>Andygirvan.com &#187; tutorial</title>
	<atom:link href="http://andygirvan.com/tag/tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://andygirvan.com</link>
	<description>Tech, music and video game enthusiast</description>
	<lastBuildDate>Tue, 31 Aug 2010 22:21:11 +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>Adding custom post types to Wordpress 3</title>
		<link>http://andygirvan.com/2010/07/adding-custom-post-types-to-wordpress-3/</link>
		<comments>http://andygirvan.com/2010/07/adding-custom-post-types-to-wordpress-3/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 12:47:22 +0000</pubDate>
		<dc:creator>Andy G</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://andygirvan.com/?p=69</guid>
		<description><![CDATA[In the latest version of the Wordpress blogging platform, the developers have (finally) introduced Custom Post Types, allowing it to become more of a CMS without extensive use of plugins. Unfortunately, after installing the latest version, you&#8217;ll probably have noticed that there doesn&#8217;t immediatly appear to be any way to create your own. That&#8217;s because]]></description>
			<content:encoded><![CDATA[<p>In the latest version of the Wordpress blogging platform, the developers have (<em>finally</em>) introduced <strong>Custom Post Types</strong>, allowing it to become more of a CMS without extensive use of plugins. Unfortunately, after installing the latest version, you&#8217;ll probably have noticed that there doesn&#8217;t immediatly appear to be any way to create your own. That&#8217;s because there is no UI to do this with &#8211; <em>doh</em>. The way to do this is to use the recently introducded method <strong>register_post_type().</strong><br />
</p>
<h2>The Example</h2>
<p>Lets say you are running a blog that will have podcasts as a content type every so often, but you don&#8217;t require a heavyweight plugin like <a href="http://wordpress.org/extend/plugins/podpress/" target="_blank">PodPress</a> &#8211; <strong>Custom Post Types </strong>are the perfect solution.<br />
</p>
<h2>The Code</h2>
<p>Take a look at the following code:</p>
<pre class="brush: js">register_post_type('podcast', array(
        'label' =&gt; __('Podcasts'),
        'singular_label' =&gt; __('Podcast'),
        'public' =&gt; true,
        'show_ui' =&gt; true,
        'hierarchical' =&gt; false,
        'query_var' =&gt; false,
        'supports' =&gt; array('title', 'editor', 'author')
));</pre>
<p>Whack that straight in your theme&#8217;s <strong>functions.php </strong>file and voila &#8211; you&#8217;ll see the new Podcast custom post type right there listed underneath the Comments button. So what did this code do exactly?<br />
</p>
<h2>The Parameters</h2>
<p>As you can see, all we&#8217;re really doing is calling the new <strong>register_post_type()</strong> method and sending through some parameters:</p>
<ul>
<li><strong>Label </strong>is pretty straight forward, what do you want the custom post type to be displayed.</li>
<li><strong>Singular label </strong>is also intuitive, what do you call ONE of your post types.</li>
<li><strong>Public </strong>is a meta argument to determine whether your post type will be accessible via search, menu&#8217;s etc&#8230; (more about this on <a href="http://codex.wordpress.org/Function_Reference/register_post_type" target="_blank">wordpress docs</a>)</li>
<li><strong>Show UI </strong>- set to true to show the custom post type on the back end. False can be set to allow extra content to determine how the custom post type is displayed in the back end.</li>
<li><strong>Hierarchical </strong>is a parameter to determine whether each custom post can have or be a parent of another.</li>
<li><strong>Supports </strong>allows you to determine what content creation fields are used when creating or editing a custom post:
<ul>
<li> &#8216;title&#8217;</li>
<li> &#8216;editor&#8217; (content)</li>
<li> &#8216;author&#8217;</li>
<li> &#8216;thumbnail&#8217; (featured image) (current theme must also support  post-thumbnails)</li>
<li> &#8216;excerpt&#8217;</li>
<li> &#8216;trackbacks&#8217;</li>
<li> &#8216;custom-fields&#8217;</li>
<li> &#8216;comments&#8217; (also will see comment count balloon on edit  screen)</li>
<li> &#8216;revisions&#8217; (will store revisions)</li>
<li> &#8216;page-attributes&#8217; (template and menu order) (hierarchical must  be true)</li>
</ul>
</li>
</ul>
<p></p>
<h2>The Results</h2>
<p>Shown below: the new &#8220;Podcasts&#8221; custom post type. Now start filling that bad boy with some content!</p>
<p><a href="http://andygirvan.com/wp-content/uploads/2010/07/result.jpg"><img class="alignnone size-full wp-image-70" title="result" src="http://andygirvan.com/wp-content/uploads/2010/07/result.jpg" alt="" width="250" height="145" /></a></p>
<p><script type="text/javascript">// <![CDATA[
 SyntaxHighlighter.all();
// ]]&gt;</script></p>
]]></content:encoded>
			<wfw:commentRss>http://andygirvan.com/2010/07/adding-custom-post-types-to-wordpress-3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
