<?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>Flexknowlogy - Jared Stein&#039;s ARCHIVED blog - update to jaredstein.org &#187; themes</title>
	<atom:link href="http://flexknowlogy.learningfield.org/tag/themes/feed/" rel="self" type="application/rss+xml" />
	<link>http://flexknowlogy.learningfield.org</link>
	<description>Jared Stein&#039;s archived blog on education, technology, culture, and the web</description>
	<lastBuildDate>Fri, 30 Oct 2009 19:35:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Using WP Custom Fields to Add CC Licensing to Blog Posts</title>
		<link>http://flexknowlogy.learningfield.org/2009/01/07/using-wp-custom-fields-to-add-cc-licensing-to-blog-posts/</link>
		<comments>http://flexknowlogy.learningfield.org/2009/01/07/using-wp-custom-fields-to-add-cc-licensing-to-blog-posts/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 15:00:40 +0000</pubDate>
		<dc:creator>Jared Stein</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[web dev]]></category>
		<category><![CDATA[creative commons]]></category>
		<category><![CDATA[licenses]]></category>
		<category><![CDATA[modifications]]></category>
		<category><![CDATA[themes]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://flexknowlogy.learningfield.org/?p=162</guid>
		<description><![CDATA[Those of you with PHP experience may already know by reputation how easy WordPress is to modify, and I&#8217;ve been having a lot of fun customizing themes for the past year. This is a quick and dirty post illustrating how to customize a WP theme to select a Creative Commons license for each post. After [...]]]></description>
			<content:encoded><![CDATA[<p>Those of you with PHP experience may already know by reputation how easy <a href="http://wordpress.org">WordPress</a> is to modify, and I&#8217;ve been having a lot of fun customizing themes for the past year. This is a quick and dirty post illustrating how to customize a WP theme to select a Creative Commons license for each post. <span id="more-162"></span> After I tested this method I played around with a few WP plug-ins, including <a href="http://techblog.touchbasic.com/html/wp-23-plugin-per-post-creative-commons-license/">Per-Post Creative Commons License</a>, which I liked a lot. But I still wanted to post this method for folks who don&#8217;t want to install plug-ins, or prefer using WordPress&#8217;s built-in Custom Fields functionality.</p>
<h4>Set Up Blog Post Licenses</h4>
<ol class="steps">
<li>
<p>From within any blog post, add a new Custom Field called, for instance, &#8220;license&#8221;.</p>
</li>
<li>
<p>Use an easy, consistent tactic for marking your license. I&#8217;m using lowercase letters separated by dashes to describe Creative Commons licenses, e.g. <strong>cc-by-sa</strong> or <strong>cc-by-nc-nd</strong>. Use these marks in each post&#8217;s &#8220;license&#8221; field from now on.</p>
</li>
</ol>
<p>Now you&#8217;re storing the license metadata on your blog&#8217;s server. It&#8217;s time to make it look cool in your theme.</p>
<h4>Customize Your WP Theme</h4>
<ol>
<li>
<p>Isolate your theme&#8217;s folder in wp-content/themes</p>
</li>
<li>
<p>Upload whatever CC license images that you want to use to your theme&#8217;s images folder. <a href="http://5tein.com/wp-content/themes/flexquare/images/licenses/licenses.zip">Here&#8217;s a ZIP file of the CC images I use</a>. Note how I named the images the same way I entered my licenses above, e.g. <strong>cc-by-sa.png</strong> or <strong>cc-by-nc-nd.png</strong>. This allows me to shortcut in the PHP.</p>
</li>
<li>
<p>Now the &#8220;hard&#8221; part: edit the files single.php and (optional) index.php. Find the spot you want to have your license display. This needs to be soon after the WP function <a href="http://wordpress.org/tags/the_content"><code>the_content()</code></a> is called. In index.php this needs to happen before the <code>endwhile</code> of the <a href="http://wordpress.org/tags/have_posts"><code>have_posts()</code></a> function.</p>
</li>
<li>
<p>Write (or paste in) a little PHP. In short we need to use the <a href="http://wordpress.org/tags/get_post_meta"><code>get_post_meta()</code></a> function to get the custom field value for this post. Here&#8217;s a quick snippet that I used to test theis approach:</p>
<p><code></p>
<p>&lt;?php<br />
&nbsp;&nbsp;&nbsp;if($license = get_post_meta($post-&gt;ID, "license", "true")) {<br />
?&gt;<br />
&nbsp;&nbsp;&nbsp;&lt;a href="http://creativecommons.org/licenses/"&gt;&lt;img src="&lt;?php bloginfo('template_directory'); ?&gt;/images/licenses/&lt;?=$license?&gt;.png" alt="&lt;?=$license?&gt; license" style="border: 0" /&gt;&lt;/a&gt;<br />
&lt;?php<br />
&nbsp;&nbsp;&nbsp;} else {<br />
&nbsp;&nbsp;&nbsp;?&gt;<br />
&nbsp;&nbsp;&nbsp;&amp;copy; &lt;?php the_time('Y');<br />
&nbsp;&nbsp;&nbsp;}<br />
?&gt;<br />
</code></p>
<p>If there is nothing in the &#8220;license&#8221; custom field, it defaults to &copy; and the post&#8217;s year.</p>
<p>You can do this on both single.php and index.php or anywhere else you have post information showing.</li>
<li>Finally, upload and test!</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://flexknowlogy.learningfield.org/2009/01/07/using-wp-custom-fields-to-add-cc-licensing-to-blog-posts/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

