<?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>Justin Tadlock &#187; Justin Tadlock</title>
	<atom:link href="http://justintadlock.com/archives/author/admin/feed" rel="self" type="application/rss+xml" />
	<link>http://justintadlock.com</link>
	<description>Life, Blogging, and WordPress</description>
	<lastBuildDate>Sun, 07 Feb 2010 08:25:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>It&#8217;s the little things that matter</title>
		<link>http://justintadlock.com/archives/2010/02/07/its-the-little-things-that-matter</link>
		<comments>http://justintadlock.com/archives/2010/02/07/its-the-little-things-that-matter#comments</comments>
		<pubDate>Sun, 07 Feb 2010 08:25:59 +0000</pubDate>
		<dc:creator>Justin Tadlock</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Discussion]]></category>

		<guid isPermaLink="false">http://justintadlock.com/?p=2291</guid>
		<description><![CDATA[Attention to detail is one of the most valuable things a developer can do to stand out from the crowd.]]></description>
			<content:encoded><![CDATA[<p>I consider myself a decent <acronym title="Hypertext Preprocessor">PHP</acronym> developer, and I know enough about design to ruin a beautiful image in Photoshop.  I&#8217;ve made quite a few plugins and themes over the past few years for WordPress as well.</p>
<p>When I&#8217;m asked how I got to the point I&#8217;m at in the WordPress community by upcoming developers, the best response I can give them is:  <em>It&#8217;s the little things that matter</em>.  If you&#8217;re not taking care of them, then the big, grand things you&#8217;re doing will only get you so far.</p>
<h2>What are the little things?</h2>
<p>The <em>little things</em> are usually things that WordPress does that slightly irritate me.  They don&#8217;t irritate me enough to switch platforms, but they are things that I wish were different.</p>
<p>I&#8217;ll show you an example of just what I mean with two pictures of the same comment using different themes.  See if you can find the major difference (i.e., the little thing) between the two.</p>
<p>The first is from the default WordPress theme:</p>
<p><img class="aligncenter" src="http://justintadlock.com/blog/wp-content/uploads/2010/02/default-pingback.png" alt="Default theme pingback" title="Pingback comment type from the Default WordPress theme" /></p>
<p>The second is from the development version of my <a href="http://themehybrid.com/themes/hybrid" title="Hybrid WordPress theme">Hybrid theme</a>:</p>
<p><img class="aligncenter" src="http://justintadlock.com/blog/wp-content/uploads/2010/02/hybrid-pingback.png" alt="Hybrid theme pingback" title="Pingback comment type from the Hybrid WordPress theme" /></p>
<p>Notice the difference?</p>
<p>The default theme displays the title text of the edit link for a pingback as &#8220;Edit comment,&#8221; which is standard for WordPress.  The <em>Hybrid</em> theme displays &#8220;Edit pingback&#8221; instead.</p>
<h2>Why make these little changes?</h2>
<p>At this point, you may simply think I&#8217;m crazy for changing &#8220;comment&#8221; to &#8220;pingback,&#8221; but the example is hardly the point.</p>
<p>What&#8217;s more important is that I would&#8217;ve likely had a user come along one day and ask, &#8220;How can I change &#8216;Edit comment&#8217; to &#8216;Edit pingback&#8217; for the pingback comment type?&#8221;  Rather than having to explain how to do this or even coming across the question at all, it&#8217;s already done.</p>
<p>An equally valid reason for doing so is that this is simply how I want things done on my personal blog.  And, when I code something that benefits me, it&#8217;s easy to give that back to the community.</p>
<h2>Those little things do matter</h2>
<p>While you may not take things as insanely far as I have in my example, it&#8217;s important to recognize how these seemingly insignificant things can help you and your users.  For example, this can translate into fewer support questions or become marketing points for your plugins/themes.</p>
<p>Attention to detail is the extra thing you should bring to the table, and end users always appreciate it when the details are covered.</p>
]]></content:encoded>
			<wfw:commentRss>http://justintadlock.com/archives/2010/02/07/its-the-little-things-that-matter/feed</wfw:commentRss>
		<slash:comments>36</slash:comments>
		</item>
		<item>
		<title>Showing custom post types on your home/blog page</title>
		<link>http://justintadlock.com/archives/2010/02/02/showing-custom-post-types-on-your-home-blog-page</link>
		<comments>http://justintadlock.com/archives/2010/02/02/showing-custom-post-types-on-your-home-blog-page#comments</comments>
		<pubDate>Tue, 02 Feb 2010 08:22:47 +0000</pubDate>
		<dc:creator>Justin Tadlock</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Tutorials]]></category>

		<guid isPermaLink="false">http://justintadlock.com/?p=2283</guid>
		<description><![CDATA[How to add custom post types to your blog post rotation on your WordPress home (blog/posts) page.]]></description>
			<content:encoded><![CDATA[<p>In the last few days, I&#8217;ve shown a few people a <a href="http://justintadlock.com/blog/wp-content/uploads/2010/02/justin-tadlock-future.png" title="Justin Tadlock future home page">screenshot</a> of something I&#8217;ve been working on for this site.  The screenshot is of a home page displaying custom post types and not just the <code>post</code> post type.  After numerous requests for the code to do this, I figured it&#8217;d be much easier to share it here.</p>
<p>WordPress version 3.0 will make creating <a href="http://core.trac.wordpress.org/ticket/9674" title="WordPress Trac: Better support for custom post types">custom post types</a> extremely simple.  But, the techniques I&#8217;ll point out in this tutorial can be used with previous versions of WordPress.</p>
<h2>Changing the post type on the home page</h2>
<p>By default, WordPress shows the <code>post</code> post type on your home page.  Let&#8217;s suppose we want to show several post types in addition to posts:</p>
<ul>
<li><code>page</code> (yes, regular pages)</li>
<li><code>album</code></li>
<li><code>movie</code></li>
<li><code>quote</code></li>
</ul>
<p>To add these, open your theme&#8217;s <code>functions.php</code> file and paste this <acronym title="Hypertext Preprocessor">PHP</acronym> code into it:</p>
<pre><code>add_filter( 'pre_get_posts', 'my_get_posts' );

function my_get_posts( $query ) {

	if ( is_home() )
		$query->set( 'post_type', array( 'post', 'page', 'album', 'movie', 'quote', 'attachment' ) );

	return $query;
}</code></pre>
<p>That&#8217;s all there is to it.</p>
<p>You may have noticed the addition of the <code>attachment</code> post type even though I didn&#8217;t mention adding it.  This is something I highly recommend adding if you&#8217;ll be showing any attachment images on your home page  For example, if you have a gallery on your home page, the images won&#8217;t appear without adding the <code>attachment</code> post type.</p>
<h2>Showing the post types in your feed</h2>
<p>Realizing that many of you might want to also add these post types to your feed to match your blog, a small change in the code is required.  All you need to do is change this line:</p>
<pre><code>if ( is_home() )</code></pre>
<p>We&#8217;ll use the <code>is_feed()</code> conditional tag:</p>
<pre><code>if ( is_home() || is_feed() )</code></pre>
<p>Now, you can have custom post types in your regular blog post rotation and your feed.  Enjoy and look for more custom post type tutorials soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://justintadlock.com/archives/2010/02/02/showing-custom-post-types-on-your-home-blog-page/feed</wfw:commentRss>
		<slash:comments>43</slash:comments>
		</item>
		<item>
		<title>2010</title>
		<link>http://justintadlock.com/archives/2010/02/01/2010</link>
		<comments>http://justintadlock.com/archives/2010/02/01/2010#comments</comments>
		<pubDate>Mon, 01 Feb 2010 09:38:19 +0000</pubDate>
		<dc:creator>Justin Tadlock</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Life]]></category>
		<category><![CDATA[health]]></category>

		<guid isPermaLink="false">http://justintadlock.com/?p=2276</guid>
		<description><![CDATA[The goals that I'd like to accomplish in my personal and online life in the 2010 year.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been putting off writing about my plans for 2010 way too long.  I typically have my goals listed before the new year rolls around, but I needed a little more time to gather my thoughts for this year.</p>
<p>My list of goals usually has too many things on it, and those goals change throughout the year.  This year, I&#8217;m going to try and keep it simple.</p>
<h2>Be healthier</h2>
<p>I&#8217;m steering clear of the &#8220;get in shape&#8221; line and getting back to what&#8217;s important &mdash; health.  This means I need to eat better and exercise more.</p>
<p>I&#8217;ve already dropped nearly 10 pounds in January by just eating better.</p>
<p>It&#8217;s not all about physical health.  I need to get out and enjoy life more than I did last year.  I spent more time than necessary behind a computer screen, and that&#8217;s not good for the ol&#8217; social life.  Just in case I&#8217;m feeling unmotivated, I&#8217;ll keep my copy of <em>Yes Man</em> near the TV.  That movie always gears me up for a whirl out in the real world.</p>
<h2>Become an English teacher</h2>
<p>Last year proved to be rough in the job hunting process.  I had never walked out of an interview and not gotten a job until last spring.  It wasn&#8217;t the last failed interview either.</p>
<p>I&#8217;ve learned from my experience and have wedged my foot into a few doors over the past year.  This time around, I&#8217;m going to give it everything I can and land a teaching job.</p>
<p>If you feel like wishing me luck, I&#8217;ll take all of it I can.</p>
<h2>Build an online empire</h2>
<p>Honestly, I want to blog more this year.  Of course, I tell myself this a few times a week.</p>
<p>One of the reasons I don&#8217;t blog as much is because it becomes tiring.  I sometimes spend hours working on a single blog post.  Doing that on a regular basis isn&#8217;t much fun.</p>
<p>I need to reorganize some things around this site.  The biggest change I&#8217;ll be making at some point this year will be the incorporation of a few <a href="http://core.trac.wordpress.org/ticket/9674" title="WordPress Trac: Better support for custom post types">custom post types</a>.  This will allow me to build the type of site I&#8217;ve been thinking about for the last couple of years and post content in ways that better suit my <a href="http://justintadlock.com/archives/2010/01/26/rule-2-the-guide-to-a-successful-blog" title="Rule #2: The guide to a successful blog">passions</a> in life.</p>
<p>I&#8217;ll post more about my thoughts on this (and probably some tutorials on how I&#8217;ll be doing it) in a future post.  For now, I&#8217;ll give you a preview of a <a href="http://justintadlock.com/blog/wp-content/uploads/2010/02/justin-tadlock-future.png" title="The future JustinTadlock.com">possible new home page</a>.</p>
<p>I also want to try my hand at a few <a href="http://www.binarymoon.co.uk/2009/11/art-direction/" title="Art Direction">art-directed posts</a>, which I hope will keep my creative juices flowing.</p>
<h2>No more goals?</h2>
<p>Sure, I have loads of smaller goals.  While the smaller goals are sometimes just as important as the larger ones, they&#8217;re usually steps that lead up to the major plans.  So, I wanted to provide an overall outlook at what I want to accomplish this year.</p>
]]></content:encoded>
			<wfw:commentRss>http://justintadlock.com/archives/2010/02/01/2010/feed</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>Rule #2: The guide to a successful blog</title>
		<link>http://justintadlock.com/archives/2010/01/26/rule-2-the-guide-to-a-successful-blog</link>
		<comments>http://justintadlock.com/archives/2010/01/26/rule-2-the-guide-to-a-successful-blog#comments</comments>
		<pubDate>Tue, 26 Jan 2010 22:49:15 +0000</pubDate>
		<dc:creator>Justin Tadlock</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Success]]></category>

		<guid isPermaLink="false">http://justintadlock.com/?p=2269</guid>
		<description><![CDATA[Running a successful blog is tough, but there's one thing that you need more than anything. Passion. Everything else is secondary.]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/Passion_%28emotion%29" title="Wikipedia: Passion"><img src="http://justintadlock.com/blog/wp-content/uploads/2010/01/passion-trumps-all-else.png" alt="Passion trumps all else." title="Passion is the most important thing for a successful blog" width="600" height="400" class="aligncenter size-full wp-image-2270" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://justintadlock.com/archives/2010/01/26/rule-2-the-guide-to-a-successful-blog/feed</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>Omelet and toast</title>
		<link>http://justintadlock.com/archives/2010/01/19/omelet-and-toast</link>
		<comments>http://justintadlock.com/archives/2010/01/19/omelet-and-toast#comments</comments>
		<pubDate>Tue, 19 Jan 2010 17:10:09 +0000</pubDate>
		<dc:creator>Justin Tadlock</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[Recipes]]></category>

		<guid isPermaLink="false">http://justintadlock.com/?p=2255</guid>
		<description><![CDATA[How to make a delicious omelet and toast breakfast that will help you get any day started right.]]></description>
			<content:encoded><![CDATA[<div id="attachment_2257" class="wp-caption aligncenter" style="width: 610px"><a href="http://justintadlock.com/archives/2010/01/19/omelet-and-toast/omelet-and-toast" rel="attachment wp-att-2257"><img src="http://justintadlock.com/blog/wp-content/uploads/2010/01/omelet-and-toast-600x508.jpg" alt="Omelet and toast breakfast" title="Omelet and toast cooked" width="600" height="508" class="size-large wp-image-2257" /></a><p class="wp-caption-text">Omelet and toast</p></div>
<p>One of my New Year&#8217;s resolutions is to eat healthier.  Isn&#8217;t that on all of our lists?  Another is to take more pictures.</p>
<p>Since I&#8217;m making an effort to do both, I thought I&#8217;d share some of the things I eat along the way.  Now for the first recipe.</p>
<p>Today, I got up bright and early simply because I wanted to make sure I got breakfast in.  I&#8217;ve had a craving for an omelet for a while.  I haven&#8217;t made one in a couple of years, so this was an experiment in making sure I didn&#8217;t completely burn something.</p>
<h2>Ingredients</h2>
<ul>
<li>Whole grain bread (I prefer Arnold&#8217;s 12 Grain)</li>
<li>1 whole egg</li>
<li>3 egg whites</li>
<li>2 Tbsp fat-free/skim milk</li>
<li>1/3 cup of cheddar cheese (reduced-fat), shredded (I used mozzarella because I was out of cheddar)</li>
<li>1/4 cup of lean ham or turkey, diced</li>
<li>1/4 green bell pepper, diced</li>
<li>1/4 red bell pepper, diced</li>
<li>1 slice of an oninon, diced</li>
<li>Black pepper</li>
<li>Chili powder</li>
<li>Ground cumin</li>
<li>Minced garlic</li>
</ul>
<h2>How to cook the meal</h2>
<p>First, you need to toss the whole egg (preferably without the shell), the three egg whites, milk, and black pepper into a bowl.  Whisk it until you&#8217;ve gotten it looking like one substance and not some weird mish-mash of foods.</p>
<p>While doing this, you should have a frying pan (or skillet as non-Southerners call them) warming up on medium heat.  Yes, this should be on a stove-top.</p>
<p>Pour your omelet mixture into the frying pan.  While waiting for the next 3-to-4 minutes for the omelet to set, toss in a sprinkle of chili powder, ground cumin, and minced garlic.  I prefer to season as desired, so there&#8217;s no set measurements for seasoning.  Feel free to experiment.</p>
<p>Once the egg mixture is set (isn&#8217;t runny on the top), add the ham, half of your cheese, green and red bell pepper, and onion onto one half of the omelet.  Take your spatula and flip the other half on top of that.  Then, sprinkle your remaining cheese across the top.</p>
<p>Let this set until the cheese on top starts to melt.  Also, you might want to toast that bread.</p>
<p>At this point, you can throw it on any type of plate you want (notice that I went with the traditional paper plate with a paper plate holder) and enjoy.</p>
<h2>My thoughts on this recipe</h2>
<p>The biggest mistake I made was not picking up cheddar cheese while grocery shopping yesterday.  Mozzarella just doesn&#8217;t do an omelet justice.  And, I may have set the heat a bit too high at first, which is why the omelet is a little browner than I wanted and had a little breakage around the edges.</p>
<p>Another thing I might try next time is tossing my ham, pepper, and onion into a separate frying pan and heating them before adding them to the omelet.  I might go with a <em>real</em> plate the next time I take a picture too.</p>
<p>Overall, it was tasty.  But, more importantly, it was much healthier than the things I was eating every day last year.</p>
]]></content:encoded>
			<wfw:commentRss>http://justintadlock.com/archives/2010/01/19/omelet-and-toast/feed</wfw:commentRss>
		<slash:comments>48</slash:comments>
		</item>
		<item>
		<title>Introducing Kirby Junior</title>
		<link>http://justintadlock.com/archives/2010/01/06/introducing-kirby-junior</link>
		<comments>http://justintadlock.com/archives/2010/01/06/introducing-kirby-junior#comments</comments>
		<pubDate>Thu, 07 Jan 2010 04:40:20 +0000</pubDate>
		<dc:creator>Justin Tadlock</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Themes]]></category>

		<guid isPermaLink="false">http://justintadlock.com/?p=2241</guid>
		<description><![CDATA[Should the <em>Kirby</em> theme be the new default WordPress theme?  I'm giving it a test run here on my blog, and I have a few thoughts.]]></description>
			<content:encoded><![CDATA[<div id="attachment_2242" class="wp-caption alignright" style="width: 260px"><img src="http://justintadlock.com/blog/wp-content/uploads/2010/01/kirby-junior.png" alt="Kirby Junior theme " title="Kirby Junior" width="250" height="455" class="size-full wp-image-2242" /><p class="wp-caption-text">Kirby Junior child theme</p></div>
<p>I&#8217;ve stuck with the same design for just over a year here on this blog, which is the longest I&#8217;ve ever kept a single design.  </p>
<p>And, to be honest, I haven&#8217;t been too motivated in updating it.</p>
<p>But, that all changed when I saw the first version of Ian Stewart&#8217;s <em>Kirby</em> theme posted via Twitter.</p>
<p>I liked the clean design and the large, yet elegant, typography.  It at least motivated me enough to start using the design from the <em>Kirby</em> theme here on my blog.</p>
<p>I don&#8217;t mind using other people&#8217;s designs, but it&#8217;s tough for me to use other code.  Pretty much anything I do has to run on top of the <a href="http://themehybrid.com/themes/hybrid" title="Hybrid WordPress theme"><em>Hybrid</em> theme</a>.  So, I set out to make <em>Kirby</em> a child theme of <em>Hybrid</em>.</p>
<p>I&#8217;m now using the <em>Kirby Junior</em> child theme on this site.</p>
<h2>A new default WordPress theme</h2>
<p>The point of this post isn&#8217;t to talk about how I&#8217;m using the theme on this site, but to make note that I&#8217;d love for <em>Kirby</em> to be the new default WordPress theme.  On the ThemeShaper blog, Ian has a fairly lengthy <a href="http://themeshaper.com/new-default-theme-wordpress-kirby/" title="An Idea for a New Default Theme for WordPress &mdash; Introducing Kirby">post on why it should be the default theme</a>.</p>
<p>I&#8217;ve never liked <em>Kubrick</em> (current default theme) enough to run on my blog.  <em>Kirby</em> is a theme that I&#8217;d actually use on my personal blog, which is something I don&#8217;t say often about other people&#8217;s themes.</p>
<h2>My notes on the <em>Kirby</em> theme</h2>
<p>While I am using just the design here on my blog, I did spend some time sifting through the theme code.  Overall, it&#8217;s solid.  These are some of my notes on version 0.3 of the <em>Kirby</em> theme.  Let&#8217;s hope Ian can make use of these.</p>
<ul>
<li>Integrate post images/thumbnails.  So many people use some sort of thumbnail setup these days, that it may as well be added.</li>
<li>Add a default <code>taxonomy.php</code> file to handle custom taxonomies.</li>
<li>A <code>searchform.php</code> file is needed for users that add a search form to their site.</li>
<li>I&#8217;m not a fan of the several <code>if</code>/<code>else</code> statements in the header for the <code>&lt;title></code> element. These could less-messily be done from the theme&#8217;s functions file.</li>
<li>The comment reply script should be added through <code>functions.php</code> and only active if a user is using threaded comments.</li>
<li>Users shouldn&#8217;t be required to use a custom field to turn on comments for pages.  There&#8217;s an admin option for this on the page editor screen.</li>
<li>Template code cleanup.  I&#8217;d like to see a better indentation system in place to help users understand what&#8217;s happening.</li>
</ul>
<p>These are my personal ideas for the theme.  Feel free to disagree.  And, please offer your suggestions and thoughts on the  <a href="http://themeshaper.com/new-default-theme-wordpress-kirby/" title="An Idea for a New Default Theme for WordPress &mdash; Introducing Kirby"><em>Kirby</em> theme post</a>.</p>
<p>Or, if you have alternate ideas for what the default WordPress theme should be, share your opinion.</p>
<p class="note">Please note that the design you see here on my site isn&#8217;t a completely accurate representation of the <em>Kirby</em> theme.  The version I&#8217;m using has several modifications.  I highly suggest checking out the actual theme to get a feel for how it works.</p>
]]></content:encoded>
			<wfw:commentRss>http://justintadlock.com/archives/2010/01/06/introducing-kirby-junior/feed</wfw:commentRss>
		<slash:comments>44</slash:comments>
		</item>
		<item>
		<title>My Snippets: WordPress Plugin</title>
		<link>http://justintadlock.com/archives/2009/12/03/my-snippets-wordpress-plugin</link>
		<comments>http://justintadlock.com/archives/2009/12/03/my-snippets-wordpress-plugin#comments</comments>
		<pubDate>Thu, 03 Dec 2009 17:10:49 +0000</pubDate>
		<dc:creator>Justin Tadlock</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Plugins]]></category>

		<guid isPermaLink="false">http://justintadlock.com/?p=2225</guid>
		<description><![CDATA[The <em>My Snippets</em> plugin gives you a meta box that allows you to control widget content on a post-by-post basis.]]></description>
			<content:encoded><![CDATA[<p>One of my favorite plugins has always been <a href="http://wordpress.org/extend/plugins/widget-logic" title="Widget Logic WordPress plugin">Widget Logic</a>, which allows you to display/hide widgets based on context.  The biggest limitation of that plugin to me is that I had to go to my <em>Widgets</em> screen in my WordPress admin every time I wanted to add a new widget for a single post or page.</p>
<p>What I wanted was something that allowed me to control widget content from the post editor, so I wouldn&#8217;t have to worry about setting my widgets.  This gave me the idea for the <em>My Snippets</em> plugin.</p>
<p>What this plugin does is add an extra meta box on the post editor that allows you to input custom content.  This content is then displayed using the <em>Snippet</em> widget in any widget area you choose.</p>
<h2>How the plugin works</h2>
<p>First, you&#8217;d add the <em>Snippet</em> widget to the widget area of your choosing.  You&#8217;ll need that to display your custom snippets.</p>
<p>When writing a post (or page), you&#8217;ll have an extra meta box labeled <em>Snippet Post Settings</em>.  In this box, you can add text, <acronym title="Hypertext Markup Language">HTML</acronym>, and shortcodes.</p>
<p>Here&#8217;s an example of adding a video snippet:</p>
<p><img src="http://justintadlock.com/blog/wp-content/uploads/2009/12/snippet-settings.png" alt="Snippet post settings" title="Snippet post settings" width="600" height="217" class="aligncenter size-full wp-image-2226" /></p>
<p>Here&#8217;s the output of the snippet, which will only be displayed on the singular view of the post/page I added it to:</p>
<p><img src="http://justintadlock.com/blog/wp-content/uploads/2009/12/snippet-widget.png" alt="Output of the Snippet widget" title="Output of the Snippet widget" width="600" height="207" class="aligncenter size-full wp-image-2227" /></p>
<p>Don&#8217;t be fooled by the example though.  You can add pretty much anything in your snippet meta box, so feel free to go wild.</p>
<h2>Download the plugin</h2>
<p>Before using the plugin, please take a moment to read through the <code>readme.html</code> file included with the plugin download.</p>
<ul>
<li><strong>Version:</strong> 0.1</li>
<li><strong>Requires:</strong> WordPress 2.8+</li>
<li><strong>Support:</strong> <a href="http://themehybrid.com/support" title="Support forums at Theme Hybrid">Support forums</a></li>
<li><a href="http://wordpress.org/extend/plugins/my-snippets" title="Download the My Snippets plugin from WordPress.org">Download</a> (from WP.org)</li>
</ul>
<p class="note">Please don&#8217;t use my contact page or the comments section below to ask support questions.  Use my <a href="http://themehybrid.com/support" title="Theme Hybrid support forums">support forums</a> at Theme Hybrid, which is where I handle all support questions for my WordPress projects.</p>
]]></content:encoded>
			<wfw:commentRss>http://justintadlock.com/archives/2009/12/03/my-snippets-wordpress-plugin/feed</wfw:commentRss>
		<slash:comments>63</slash:comments>
		</item>
		<item>
		<title>Sidebar (widget area) descriptions in WordPress 2.9</title>
		<link>http://justintadlock.com/archives/2009/11/24/sidebar-widget-area-descriptions-in-wordpress-2-9</link>
		<comments>http://justintadlock.com/archives/2009/11/24/sidebar-widget-area-descriptions-in-wordpress-2-9#comments</comments>
		<pubDate>Wed, 25 Nov 2009 02:05:41 +0000</pubDate>
		<dc:creator>Justin Tadlock</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Tutorials]]></category>

		<guid isPermaLink="false">http://justintadlock.com/?p=2216</guid>
		<description><![CDATA[How to add descriptions to individual widget areas in WordPress 2.9 and why this is a useful feature for end users.]]></description>
			<content:encoded><![CDATA[<p><span class="drop-cap">H</span>ave you ever used a WordPress theme with more than a couple of widget areas?  More specifically, have you ever used a WordPress theme with loads of widget areas and no idea how they all worked within the theme?</p>
<p>If you&#8217;ve ever used a theme of mine, you know I love adding widget areas everywhere. And, I know this can be confusing for some people.</p>
<p>Fortunately, WordPress 2.9 will allow theme developers to add a description for each widget area.  This should help end users figure out what the heck is going on.</p>
<h2>Widget descriptions from a user&#8217;s view</h2>
<p>If you&#8217;re an end user and your theme author has added descriptions, you&#8217;ll see the description near the top of the widget area on the <em>Widgets</em> admin screen.</p>
<p><img src="http://justintadlock.com/blog/wp-content/uploads/2009/11/sidebar-descriptions.png" alt="Widget Area Descriptions" title="Widget Area Descriptions" width="600" height="428" class="aligncenter size-full wp-image-2217" /></p>
<h2>Adding descriptions to widget areas</h2>
<p>If you&#8217;re a theme developer, adding descriptions to your widget areas is as simple as adding an extra argument to the <code>register_sidebar()</code> function. Use the below <acronym title="Hypertext Preprocessor">PHP</acronym> code as a guide.</p>
<pre><code>add_action( 'init', 'register_my_widget_areas' );

function register_my_widget_areas() {

	register_sidebar( array(
		'name' => __('Primary', 'example'),
		'id' => 'primary',
		'description' => __('The main widget area, most often used as a sidebar.', 'example'),
		'before_widget' => '&lt;div id="%1$s" class="widget %2$s widget-%2$s">',
		'after_widget' => '&lt;/div>',
		'before_title' => '&lt;h3 class="widget-title">',
		'after_title' => '&lt;/h3>'
	) );
}</code></pre>
<p>The new code allowed in 2.9 is the <code>description</code> argument.</p>
<pre><code>'description' => __('The main widget area, most often used as a sidebar.', 'example'),</code></pre>
<p>Theme authors, it&#8217;s time to implement this new feature for your users.  It will take less than five minutes to add to your theme and should at least cut back on a few support queries.</p>
]]></content:encoded>
			<wfw:commentRss>http://justintadlock.com/archives/2009/11/24/sidebar-widget-area-descriptions-in-wordpress-2-9/feed</wfw:commentRss>
		<slash:comments>51</slash:comments>
		</item>
		<item>
		<title>Everything you need to know about WordPress 2.9&#8217;s post image feature</title>
		<link>http://justintadlock.com/archives/2009/11/16/everything-you-need-to-know-about-wordpress-2-9s-post-image-feature</link>
		<comments>http://justintadlock.com/archives/2009/11/16/everything-you-need-to-know-about-wordpress-2-9s-post-image-feature#comments</comments>
		<pubDate>Mon, 16 Nov 2009 07:50:08 +0000</pubDate>
		<dc:creator>Justin Tadlock</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Tutorials]]></category>

		<guid isPermaLink="false">http://justintadlock.com/?p=2126</guid>
		<description><![CDATA[An in-depth look at how the post image feature in WordPress 2.9 can be used from the perspective of both end users and developers.]]></description>
			<content:encoded><![CDATA[<p><span class="drop-cap">Y</span>ou may have heard a bit of news about a new thumbnail feature for themes coming to WordPress 2.9.  Yes, you&#8217;ll be able to easily upload a post thumbnail.  However, it&#8217;s not just thumbnails.  The image will have various sizes.  So, I&#8217;m going to refer to this feature as the post image feature.</p>
<p>In this tutorial, I&#8217;ll be covering the various things you can do with the post image feature.  Some things will be specific to end users while others will be useful for theme and plugin developers.</p>
<p>One important thing to note is that this new feature is an image-based representation of a post.  The image itself is directly tied to your post.  You shouldn&#8217;t think of it as something different than that.</p>
<h2>How does an end user make use of this feature?</h2>
<p>First, your theme must add support for it.  Otherwise, you won&#8217;t be able to use it.  At this point, let&#8217;s assume that your theme does support it.  I&#8217;ll go over instructions for theme authors later.</p>
<p>To use this feature, you must be within the post editing screen of your WordPress admin.  On this screen, you&#8217;ll see a new meta box labeled &#8220;Post thumbnail&#8221; (or &#8220;Page thumbnail&#8221; for pages).  There&#8217;ll be a link to &#8220;Set thumbnail,&#8221; which will allow you to use the media uploader to load a new image.</p>
<p><img src="http://justintadlock.com/blog/wp-content/uploads/2009/11/the-post-image.png" alt="Screenshot of WordPress 2.9's post image uploader" title="The Post Image" width="600" height="429" class="aligncenter size-full wp-image-2127" /></p>
<h2>It&#8217;s not just for thumbnails</h2>
<p>Even though it is called &#8220;post thumbnails,&#8221; we can technically use the feature for all sorts of things (e.g., feature images, medium-sized images for the front page, etc.).</p>
<p>By default, WordPress gives you several image sizes each time you upload an image.  These image sizes are:</p>
<ul>
<li>Thumbnail</li>
<li>Medium</li>
<li>Large</li>
<li>Full (the image you uploaded)</li>
</ul>
<p>Some plugins even extend this by allowing more intermediate sizes.  The important thing is that you understand that more than thumbnails can be used here.</p>
<h2>How to add support for the post image feature in a theme</h2>
<p>Theme authors, I&#8217;m going to make this simple for you.  You only need one line of code to turn this feature on for your users.  Add this to your theme&#8217;s <code>functions.php</code> file:</p>
<pre><code>add_theme_support( 'post-thumbnails' );</code></pre>
<p>Or, you can register support for specific post types.  For example, let&#8217;s suppose you wanted to add thumbnail support for both the <code>post</code> and <code>movie</code> post type but not for the <code>page</code> post type.  You&#8217;d use this instead:</p>
<pre><code>add_theme_support( 'post-thumbnails', array( 'post', 'page' ) );</code></pre>
<p>Of course, that one line doesn&#8217;t actually add anything to the front end for you.  You&#8217;ll need to call the image somewhere within The Loop in your template files.  For example, you might want to add thumbnails to your category archives.  You&#8217;d do this by adding this line of code:</p>
<pre><code>&lt;?php the_post_thumbnail( 'thumbnail' ); ?></code></pre>
<p>Or, maybe you have a section on a special template that calls for medium-sized images:</p>
<pre><code>&lt;?php the_post_thumbnail( 'medium' ); ?></code></pre>
<p>Or, a huge sliding feature area on your front page and need the full-sized image:</p>
<pre><code>&lt;?php the_post_thumbnail( 'full' ); ?></code></pre>
<p>That&#8217;s all there is to it.  As a theme author, you can hand over some powerful functionality to your users with just a couple of lines of code.</p>
<p>The rest of this tutorial will focus on developer features and some options for using older images.</p>
<h2>Checking if the post has an image</h2>
<p>Sometimes, you may need to check if a post has an image.  There&#8217;s a function for that called <code>has_post_thumbnail()</code>, which will return <code>true</code> or <code>false</code> based on whether there&#8217;s an image.</p>
<p>In this example, we&#8217;ll check if there&#8217;s an image.  If there&#8217;s not, we&#8217;ll show a default image instead.</p>
<pre><code>&lt;?php
	if ( has_post_thumbnail() )
		the_post_thumbnail( 'thumbnail' );
	else
		echo '&lt;img src="default-image.png" alt="Example Image" title="Example" />';
?></code></pre>
<h2>Getting the post image ID</h2>
<p>Maybe you need to write your own custom script but still want to allow users to upload their own images.  You can grab the post image ID and use it.  This ID is saved as the meta value for the meta key <code>_thumbnail_id</code>.  It is the ID of the attached file.</p>
<p>You only need to call the function in your code like so:</p>
<pre><code>$image_id = get_post_thumbnail_id();</code></pre>
<h2>How to return the image instead of displaying it</h2>
<p>In some scenarios, you might want to return the post image for use in your <acronym title="Hypertext Preprocessor">PHP</acronym> code instead of displaying it.</p>
<p>Here&#8217;s an example of that functionality:</p>
<pre><code>$image = get_the_post_thumbnail( $post->ID, 'thumbnail' );</code></pre>
<h2>How to filter the image size</h2>
<p>Some plugin developers may want to filter the image size (or maybe even child theme authors).  The <code>post_thumbnail_size</code> filter hook is available for that.  The filter function below is for changing the <code>thumbnail</code> size to <code>medium</code>.</p>
<p>Add this <acronym title="Hypertext Preprocessor">PHP</acronym> code to your theme&#8217;s <code>functions.php</code> file or your plugin file:</p>
<pre><code>add_filter( 'post_thumbnail_size', 'my_post_image_size' );

function my_post_image_size( $size ) {
	$size = 'medium';
	return $size;
}</code></pre>
<h2>Changing the <acronym title="Hypertext Markup Language">HTML</acronym> output of the post image</h2>
<p>There may be some scenarios where you&#8217;ll want to change the <acronym title="Hypertext Markup Language">HTML</acronym> markup of the displayed image.  In this example, I&#8217;ll show you how to wrap the image with a link to the post.</p>
<p>Add this <acronym title="Hypertext Preprocessor">PHP</acronym> code to your theme&#8217;s <code>functions.php</code> file or your plugin file:</p>
<pre><code>add_filter( 'post_thumbnail_html', 'my_post_image_html', 10, 3 );

function my_post_image_html( $html, $post_id, $post_image_id ) {

	$html = '&lt;a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( get_post_field( 'post_title', $post_id ) ) . '">' . $html . '&lt;/a>';

	return $html;
}</code></pre>
<h2>What happens to my old images/thumbnails?</h2>
<p>If you&#8217;re like me and many others, you may have been using custom fields to add images to your posts for years.  If you switch to this new method, everything will be lost.</p>
<p>I&#8217;ve got a solution for this problem:  The <a href="http://wordpress.org/extend/plugins/get-the-image" title="Get the Image WordPress plugin">Get the Image</a> plugin.</p>
<p>Version 0.4 will be released when WordPress 2.9 is out.  Not only will support be added for the new WordPress post image feature, but you won&#8217;t lose all of the hard work you&#8217;ve put in.  The plugin will have the ability to check for post images in five different ways (in the below order):</p>
<ul>
<li>Custom fields.</li>
<li>New post image feature.</li>
<li>Attached image.</li>
<li>Scan the post for images.</li>
<li>Default image.</li>
</ul>
<p>For those of you already using this plugin or a theme of mine that includes the script, you&#8217;ll only have to upgrade the plugin or theme.  The feature will be turned on for you by default, so you will be able to start using the new feature without touching anything but an upgrade button.</p>
<h2>Have fun with your new post images</h2>
<p>I hope this tutorial has given you an in-depth look at the post image feature.  There are <a href="http://www.binarymoon.co.uk/2009/10/wordpress-the_post_image/" title="WordPress 2.9 &mdash; the_post_image">some limitations</a>, but on the whole, this feature will make things much easier for end users compared to the currently-available methods.</p>
<p>If you&#8217;re a user of my <a href="http://wordpress.org/extend/plugins/get-the-image" title="Get the Image WordPress plugin">Get the Image plugin</a> or <a href="http://themehybrid.com/themes/hybrid" title="Hybrid theme framework">Hybrid theme</a>, look out for an update within a few days of WordPress 2.9.  You&#8217;ll be able to start using the post image functionality soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://justintadlock.com/archives/2009/11/16/everything-you-need-to-know-about-wordpress-2-9s-post-image-feature/feed</wfw:commentRss>
		<slash:comments>131</slash:comments>
		</item>
		<item>
		<title>Excerpts and taxonomies for pages in WordPress 2.9</title>
		<link>http://justintadlock.com/archives/2009/11/09/excerpts-and-taxonomies-for-pages-in-wordpress-2-9</link>
		<comments>http://justintadlock.com/archives/2009/11/09/excerpts-and-taxonomies-for-pages-in-wordpress-2-9#comments</comments>
		<pubDate>Mon, 09 Nov 2009 10:11:00 +0000</pubDate>
		<dc:creator>Justin Tadlock</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Tutorials]]></category>

		<guid isPermaLink="false">http://justintadlock.com/?p=2122</guid>
		<description><![CDATA[How to make use of a simple file change in WordPress 2.9 to add an excerpt box and custom taxonomy boxes to your page editor.]]></description>
			<content:encoded><![CDATA[<p><span class="drop-cap">W</span>hile the information in this tutorial <em>will</em> be focused on excerpts and taxonomies, the big change in WordPress 2.9 is that the meta box functions have been included in a new file: <code>/wp-admin/include/meta-boxes.php</code>.  This change allows us to do some fun things because the code is not limited to a single area anymore.</p>
<p>In this tutorial, you&#8217;ll learn how to utilize the <code>add_meta_box()</code> functionality to add two things to your pages:</p>
<ol>
<li>Excerpt box.</li>
<li>Custom taxonomies boxes.</li>
</ol>
<p>Being able to add these meta boxes to pages isn&#8217;t the limit.  This tutorial should serve as a starting point.  You could do the same for custom post types, links, or anything that fires the <code>do_meta_boxes</code> action hook.</p>
<h2>Adding an excerpt box to your page editor</h2>
<p>The first thing you should do is open your theme&#8217;s <code>functions.php</code> file in your favorite text editor.  Paste the following <acronym title="Hypertext Preprocessor">PHP</acronym> code into it:</p>
<pre><code>add_action( 'admin_menu', 'my_page_excerpt_meta_box' );

function my_page_excerpt_meta_box() {
	add_meta_box( 'postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'page', 'normal', 'core' );
}</code></pre>
<p>Now, you&#8217;ll be able to add excerpts to your pages, just like posts.  This can come in handy with themes that display search results in excerpt form.</p>
<h2>Adding custom taxonomies to your page editor</h2>
<p>This one will be a bit trickier.  I&#8217;ll have to assume you&#8217;ve created a custom taxonomy specifically for pages.  If you&#8217;re unfamiliar with this process, you need to familiarize yourself with <a href="http://justintadlock.com/archives/2009/05/06/custom-taxonomies-in-wordpress-28" title="Custom taxonomies in WordPress 2.8">creating custom taxonomies</a>.</p>
<p>Let&#8217;s assume you&#8217;ve created a &#8220;People&#8221; taxonomy for pages.  Your custom taxonomy code should look a little like this.  </p>
<pre><code>register_taxonomy( 'people', 'page', array( 'hierarchical' => false, 'label' => 'People', 'query_var' => true, 'rewrite' => true ) );</code></pre>
<p>The important thing in that line is <code>page</code>.  We&#8217;ll be adding meta boxes for all taxonomies that have been registered for pages.</p>
<p>Again, we&#8217;ll go to our theme&#8217;s <code>functions.php</code> file.  Paste this <acronym title="Hypertext Preprocessor">PHP</acronym> code in:</p>
<pre><code>add_action( 'admin_menu', 'my_page_taxonomy_meta_boxes' );

function my_page_taxonomy_meta_boxes() {
	foreach ( get_object_taxonomies( 'page' ) as $tax_name ) {
		if ( !is_taxonomy_hierarchical( $tax_name ) ) {
			$tax = get_taxonomy( $tax_name );
			add_meta_box( "tagsdiv-{$tax_name}", $tax->label, 'post_tags_meta_box', 'page', 'side', 'core' );
		}
	}
}</code></pre>
<p>Once that&#8217;s done, you&#8217;ll be able to use your page-based custom taxonomies.</p>
<p class="note">Please note that hierarchical taxonomies aren&#8217;t going to be available yet.  Maybe in WordPress 3.0?</p>
<h2>A good move by WordPress</h2>
<p>I&#8217;m glad WordPress is moving in this direction with some of its functionality.  Average Joe might not realize the implications of something as simple as moving code to another file, but developers should rejoice.  The reuse of code is a cornerstone of good development practice.  By making things more modular, it becomes easier to create new things without rewriting a lot of code.</p>
<p>I&#8217;ve shown you how to do these things with pages.  Just imagine being able to make these simple and quick changes for custom post types (i.e., content types), essentially having the ability to create any type of site you want with WordPress.</p>
]]></content:encoded>
			<wfw:commentRss>http://justintadlock.com/archives/2009/11/09/excerpts-and-taxonomies-for-pages-in-wordpress-2-9/feed</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
	</channel>
</rss>
