<?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>AmberWeinberg.com &#187; Phil Splice</title> <atom:link href="http://www.amberweinberg.com/author/phil/feed/" rel="self" type="application/rss+xml" /><link>http://www.amberweinberg.com</link> <description>Design, Development and Freelance Articles and Tutorials</description> <lastBuildDate>Mon, 06 Feb 2012 21:09:07 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>Post Thumbnails via WordPress</title><link>http://www.amberweinberg.com/post-thumbnails-via-wordpress/</link> <comments>http://www.amberweinberg.com/post-thumbnails-via-wordpress/#comments</comments> <pubDate>Mon, 01 Mar 2010 16:00:34 +0000</pubDate> <dc:creator>Phil Splice</dc:creator> <category><![CDATA[blog]]></category> <category><![CDATA[development]]></category> <category><![CDATA[php]]></category> <category><![CDATA[tutorial]]></category> <category><![CDATA[wordpress]]></category><guid
isPermaLink="false">http://www.amberweinberg.com/?p=1617</guid> <description><![CDATA[Images are more appealing than text alone so, wouldn&#8217;t it be nice to upload and place a thumbnail next to the post? It&#8217;s very simple with WordPress 2.9+, all you need is a few lines of code in your functions.php.  So, therefore we need to open functions.php as well as index.php. The Function In your [...]]]></description> <content:encoded><![CDATA[<p><img
class="alignleft size-full wp-image-1635" title="304713469_53a7474bd1_o-1" src="http://www.amberweinberg.com/wp-content/uploads/2010/02/304713469_53a7474bd1_o-1.png" alt="" width="590" height="222" />Images are more appealing than text alone so, wouldn&#8217;t it be nice to upload and place a thumbnail next to the post?</p><p>It&#8217;s very simple with WordPress 2.9+, all you need is a few lines of code in your functions.php.  So, therefore we need to open functions.php as well as index.php.</p><h3>The Function</h3><p>In your functions.php place this code and tweak as necessary:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>php
add_theme_support<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'post-thumbnails'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'post'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">//displays thumbnail for only posts</span>
set_post_thumbnail_size<span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">50</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">50</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">//50 pixels wide by 50 pixels long, box resize mode</span>
<span style="color: #339933;">&gt;</span></pre></div></div><h3>Placing the Thumbnail</h3><p>Wherever you would like the thumbnail to appear place this code:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>php
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> has_post_thumbnail<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>  <span style="color: #b1b100;">echo</span> the_post_thumbnail<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;img src=&quot;http://yourdomain.com/default.png&quot; /&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&gt;</span></pre></div></div><p>This tells WordPress that if this post has a thumbnail uploaded (we will get to that in a moment), display it; otherwise display the default image.</p><h3>Uploading the Thumbnail</h3><p><img
class="alignright size-full wp-image-1645" title="mac_screenshot" src="http://www.amberweinberg.com/wp-content/uploads/2010/03/mac_screenshot1.png" alt="" width="284" height="61" />How do you upload a thumbnail?  When adding a new post, under categories look for &#8220;Post Thumbnail&#8221; and click &#8220;Set thumbnail&#8221;.</p><p>Of course, this can be styled and tweaked to your needs so have fun tweaking and thanks for reading!</p><p><em>Image by by </em><a
href="http://www.amberweinberg.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5mbGlja3IuY29tL3Bob3Rvcy9kY3JlZXZlczIwMDAv"><em>David Reeves</em></a></p> <img
src="http://www.amberweinberg.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=1617" width="1" height="1" style="display: none;" />]]></content:encoded> <wfw:commentRss>http://www.amberweinberg.com/post-thumbnails-via-wordpress/feed/</wfw:commentRss> <slash:comments>7</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching using disk: basic
Object Caching 210/229 objects using disk: basic

Served from: www.amberweinberg.com @ 2012-02-07 16:14:54 -->
