<?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>Blog Tutorials &#187; Code Snippets</title>
	<atom:link href="http://blogtuts.com/category/code-snippets/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogtuts.com</link>
	<description>Blog Tutorials, Tools, and Resources</description>
	<lastBuildDate>Sun, 30 Aug 2009 16:19:43 +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>Code: Display Last Modified Date in WordPress</title>
		<link>http://blogtuts.com/last-modified-date-code-wordpress/</link>
		<comments>http://blogtuts.com/last-modified-date-code-wordpress/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 13:29:32 +0000</pubDate>
		<dc:creator>Kyle Eslick</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[Last Modified Date]]></category>
		<category><![CDATA[WordPress Code]]></category>
		<category><![CDATA[WordPress Hacks]]></category>

		<guid isPermaLink="false">http://blogtuts.com/?p=77</guid>
		<description><![CDATA[If you run a website or blog professionally, it is always good business practice to update your older posts to keep them as valid and current as possible.   This helps retain (or even grow) their search engine positions, and helps keep your blog from having dead links or outdated content.  One of the things I [...]

<div class="posts"><h3>Related Posts</h3></div><ul><li><a href='http://blogtuts.com/wordpress-code-category-archives/' rel='bookmark' title='Permanent Link: Code: Display Categories and Archives in WordPress'>Code: Display Categories and Archives in WordPress</a></li>
<li><a href='http://blogtuts.com/code-how-to-display-recent-posts-in-wordpress/' rel='bookmark' title='Permanent Link: Code:  How to Display Recent Posts in WordPress'>Code:  How to Display Recent Posts in WordPress</a></li>
<li><a href='http://blogtuts.com/code-displaying-updated-posts-in-wordpress/' rel='bookmark' title='Permanent Link: Code: Displaying Updated Posts in WordPress'>Code: Displaying Updated Posts in WordPress</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>If you run a website or blog professionally, it is always good business practice to update your older posts to keep them as valid and current as possible.   This helps retain (or even grow) their search engine positions, and helps keep your blog from having dead links or outdated content. </p>
<p>One of the things I recommend readers do on these types of blogs which use WordPress is to adjust the date field to instead show the last modified date.   This way posts that were written two years ago won&#8217;t have that date if you&#8217;ve updated them more recently!</p>
<p>Here is the code you&#8217;ll need to easily accomplish this.   As always, you&#8217;ll want to make a backup of your single.php file (or any files you will be changing) before proceeding.</p>
<p><span id="more-77"></span>Locate the following code in your template (may not look <em>exactly</em> like this):</p>
<p><code>Posted on: &lt;?php the_time('l, F jS, Y') ?&gt;</code></p>
<p>Now replace it with the following code:</p>
<p><code>Posted on &lt;?php the_time('F jS, Y') ?&gt;<br />
&lt;?php $u_time = get_the_time('U');<br />
$u_modified_time = get_the_modified_time('U');<br />
if ($u_modified_time != $u_time) {<br />
echo "and last modified on ";<br />
the_modified_time('F jS, Y');<br />
echo ". "; } ?&gt;</code></p>
<p>Now your posts should show the last modified date immediately after the original posting date, rather than just showing the original post date!</p>
<img src="http://blogtuts.com/?ak_action=api_record_view&id=77&type=feed" alt="" />

<div class="posts"><h3>Related Posts</h3></div><ul><li><a href='http://blogtuts.com/wordpress-code-category-archives/' rel='bookmark' title='Permanent Link: Code: Display Categories and Archives in WordPress'>Code: Display Categories and Archives in WordPress</a></li>
<li><a href='http://blogtuts.com/code-how-to-display-recent-posts-in-wordpress/' rel='bookmark' title='Permanent Link: Code:  How to Display Recent Posts in WordPress'>Code:  How to Display Recent Posts in WordPress</a></li>
<li><a href='http://blogtuts.com/code-displaying-updated-posts-in-wordpress/' rel='bookmark' title='Permanent Link: Code: Displaying Updated Posts in WordPress'>Code: Displaying Updated Posts in WordPress</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://blogtuts.com/last-modified-date-code-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Code: Adding Edit Buttons to WordPress</title>
		<link>http://blogtuts.com/code-adding-edit-buttons-to-wordpress/</link>
		<comments>http://blogtuts.com/code-adding-edit-buttons-to-wordpress/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 13:04:18 +0000</pubDate>
		<dc:creator>Kyle Eslick</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[Edit Button]]></category>
		<category><![CDATA[Edit WordPress]]></category>
		<category><![CDATA[WordPress Code]]></category>
		<category><![CDATA[WordPress Hacks]]></category>

		<guid isPermaLink="false">http://blogtuts.com/?p=70</guid>
		<description><![CDATA[There are a growing number of premium themes on the market these days for WordPress users, many of which are extremely advanced, yet I&#8217;ve found that many designers fail to add some of the most basic things all themes should have.  One of the things many designers forget to do is code &#8221;edit&#8221; buttons on their posts, pages, and comments.   [...]

<div class="posts"><h3>Related Posts</h3></div><ul><li><a href='http://blogtuts.com/add-print-this-button/' rel='bookmark' title='Permanent Link: Code: Add A &#8220;Print This&#8221; Button'>Code: Add A &#8220;Print This&#8221; Button</a></li>
<li><a href='http://blogtuts.com/wordpress-code-recent-comments-top-commentators/' rel='bookmark' title='Permanent Link: Code: Add Recent Comments and Top Comments to WordPress'>Code: Add Recent Comments and Top Comments to WordPress</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>There are a growing number of <a href="http://premiumthemes.info/">premium themes</a> on the market these days for WordPress users, many of which are extremely advanced, yet I&#8217;ve found that many designers fail to add some of the most basic things all themes should have.  One of the things many designers forget to do is code &#8221;edit&#8221; buttons on their posts, pages, and comments.  </p>
<p>For those unfamilar with these buttons, they only show up for people who are logged into the admin panel (readers can&#8217;t see them).   When clicked, you are routed directly to the post/page or comment within the admin panel so you can edit the post.   It has been my experience that having access to these buttons can save a lot of time when trying to manage and update older posts. </p>
<p><span id="more-70"></span>If you&#8217;d like to add an &#8220;edit&#8221; button on your individual <strong>posts</strong> or <strong>pages</strong>, here is the code you will want to place somewhere in your post and/or page template (usually called single.php and page.php) where you want it to display:</p>
<p><code>&lt;?php edit_post_link(__("**Edit**"), ''); ?&gt;</code></p>
<p>If you&#8217;d like to add an &#8220;edit&#8221; button to your individual <strong>comments</strong>, here is the code you need to place somewhere in your comments loop (usually called comments.php) where you want it to display:</p>
<p><code>&lt;?php edit_comment_link(__("**Edit**"), ''); ?&gt;</code></p>
<p>Don&#8217;t forget that you can also wrap them in a div to control its placement and appearance.</p>
<img src="http://blogtuts.com/?ak_action=api_record_view&id=70&type=feed" alt="" />

<div class="posts"><h3>Related Posts</h3></div><ul><li><a href='http://blogtuts.com/add-print-this-button/' rel='bookmark' title='Permanent Link: Code: Add A &#8220;Print This&#8221; Button'>Code: Add A &#8220;Print This&#8221; Button</a></li>
<li><a href='http://blogtuts.com/wordpress-code-recent-comments-top-commentators/' rel='bookmark' title='Permanent Link: Code: Add Recent Comments and Top Comments to WordPress'>Code: Add Recent Comments and Top Comments to WordPress</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://blogtuts.com/code-adding-edit-buttons-to-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Code: Display Categories and Archives in WordPress</title>
		<link>http://blogtuts.com/wordpress-code-category-archives/</link>
		<comments>http://blogtuts.com/wordpress-code-category-archives/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 21:58:05 +0000</pubDate>
		<dc:creator>Kyle Eslick</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[WordPress Archives]]></category>
		<category><![CDATA[WordPress Categories]]></category>
		<category><![CDATA[WordPress Code]]></category>

		<guid isPermaLink="false">http://blogtuts.com/?p=52</guid>
		<description><![CDATA[There has been some debate by bloggers over the past few years as to the value of displaying your archives, with some bloggers going as far as to not even display their categories!    The general idea is that the use of recent posts, popular posts, and a built-in search feature will allow your readers to [...]

<div class="posts"><h3>Related Posts</h3></div><ul><li><a href='http://blogtuts.com/wordpress-code-recent-comments-top-commentators/' rel='bookmark' title='Permanent Link: Code: Add Recent Comments and Top Comments to WordPress'>Code: Add Recent Comments and Top Comments to WordPress</a></li>
<li><a href='http://blogtuts.com/code-displaying-updated-posts-in-wordpress/' rel='bookmark' title='Permanent Link: Code: Displaying Updated Posts in WordPress'>Code: Displaying Updated Posts in WordPress</a></li>
<li><a href='http://blogtuts.com/code-how-to-display-recent-posts-in-wordpress/' rel='bookmark' title='Permanent Link: Code:  How to Display Recent Posts in WordPress'>Code:  How to Display Recent Posts in WordPress</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>There has been some debate by bloggers over the past few years as to the value of displaying your archives, with some bloggers going as far as to not even display their categories!    The general idea is that the use of recent posts, popular posts, and a built-in search feature will allow your readers to find what they are looking for.</p>
<p>Well, I for one still believe that categories and archives should be displayed on blogs.   If you&#8217;d like to do the same for a WordPress blog, here is the code you&#8217;ll want to use.   For your convenience, we&#8217;ve provided two options for each:  traditional display and drop-down menus.</p>
<p>Simply paste the WordPress code below in your sidebar.php file where you want the category or archives to display:<span id="more-52"></span></p>
<h3><strong>Display Categories</strong></h3>
<p><code>&lt;h2&gt;Categories&lt;/h2&gt;<br />
&lt;ul&gt;<br />
&lt;?php wp_list_cats('sort_column=name'); ?&gt;<br />
&lt;/ul&gt;</code></p>
<h3><strong>Display Categories in Drop-Down Box</strong></h3>
<p><code>&lt;form action="&lt;?php bloginfo('url'); ?&gt;/" method="get"&gt;<br />
&lt;?php<br />
$select = wp_dropdown_categories('show_option_none=Select category&amp;show_count=1&amp;orderby=name&amp;echo=0');<br />
$select = preg_replace("#&lt;select([^&gt;]*)&gt;#”, “&lt;select$1 onchange=’return this.form.submit()’&gt;”, $select); echo $select; ?&gt;<br />
&lt;noscript&gt;&lt;input type=”submit” value=”View” /&gt;&lt;/noscript&gt;<br />
&lt;/form&gt;</code></p>
<h3><strong>Display Archives</strong></h3>
<p><code>&lt;h2&gt;Archives&lt;/h2&gt;<br />
&lt;ul&gt;<br />
&lt;?php wp_get_archives('type=monthly'); ?&gt;<br />
&lt;/ul&gt;</code></p>
<h3><strong>Display Archives in a Drop-Down Box</strong></h3>
<p><code>&lt;select name=\"archive-dropdown\" onChange='document.location.href=this.options[this.selectedIndex].value;’&gt;<br />
&lt;option value=\”\”&gt;&lt;?php echo attribute_escape(__(’Select Month’)); ?&gt;&lt;/option&gt;<br />
&lt;?php wp_get_archives(’type=monthly&amp;format=option&amp;show_post_count=1?); ?&gt; &lt;/select&gt;</code></p>
<img src="http://blogtuts.com/?ak_action=api_record_view&id=52&type=feed" alt="" />

<div class="posts"><h3>Related Posts</h3></div><ul><li><a href='http://blogtuts.com/wordpress-code-recent-comments-top-commentators/' rel='bookmark' title='Permanent Link: Code: Add Recent Comments and Top Comments to WordPress'>Code: Add Recent Comments and Top Comments to WordPress</a></li>
<li><a href='http://blogtuts.com/code-displaying-updated-posts-in-wordpress/' rel='bookmark' title='Permanent Link: Code: Displaying Updated Posts in WordPress'>Code: Displaying Updated Posts in WordPress</a></li>
<li><a href='http://blogtuts.com/code-how-to-display-recent-posts-in-wordpress/' rel='bookmark' title='Permanent Link: Code:  How to Display Recent Posts in WordPress'>Code:  How to Display Recent Posts in WordPress</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://blogtuts.com/wordpress-code-category-archives/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Code: Add Recent Comments and Top Comments to WordPress</title>
		<link>http://blogtuts.com/wordpress-code-recent-comments-top-commentators/</link>
		<comments>http://blogtuts.com/wordpress-code-recent-comments-top-commentators/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 21:51:36 +0000</pubDate>
		<dc:creator>Kyle Eslick</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[Recent Comments]]></category>
		<category><![CDATA[Recent Comments Code]]></category>
		<category><![CDATA[Top Commentators Code]]></category>
		<category><![CDATA[Top Comments]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[WordPress Code]]></category>

		<guid isPermaLink="false">http://blogtuts.com/?p=49</guid>
		<description><![CDATA[Throughout our WordPress code series, we&#8217;ve been providing a number of code options for designers who want to use actual code rather than using the widget system built into WordPress. In this post, we&#8217;ll be providing the code for creating both recent comments and top comments to the sidebar of your WordPress blog. Displaying Recent [...]

<div class="posts"><h3>Related Posts</h3></div><ul><li><a href='http://blogtuts.com/code-displaying-updated-posts-in-wordpress/' rel='bookmark' title='Permanent Link: Code: Displaying Updated Posts in WordPress'>Code: Displaying Updated Posts in WordPress</a></li>
<li><a href='http://blogtuts.com/separating-trackbacks-and-comments-in-wordpress-2-7/' rel='bookmark' title='Permanent Link: Separating Trackbacks and Comments in WordPress 2.7+'>Separating Trackbacks and Comments in WordPress 2.7+</a></li>
<li><a href='http://blogtuts.com/code-how-to-display-recent-posts-in-wordpress/' rel='bookmark' title='Permanent Link: Code:  How to Display Recent Posts in WordPress'>Code:  How to Display Recent Posts in WordPress</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>Throughout our WordPress code series, we&#8217;ve been providing a number of code options for designers who want to use actual code rather than using the widget system built into WordPress.</p>
<p>In this post, we&#8217;ll be providing the code for creating both recent comments and top comments to the sidebar of your WordPress blog.<span id="more-49"></span></p>
<h3>Displaying Recent Comments</h3>
<p><code>&lt;?php<br />
global $wpdb;<br />
$sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID,<br />
comment_post_ID, comment_author, comment_date_gmt, comment_approved,<br />
comment_type,comment_author_url,<br />
SUBSTRING(comment_content,1,30) AS com_excerpt<br />
FROM $wpdb-&gt;comments<br />
LEFT OUTER JOIN $wpdb-&gt;posts ON ($wpdb-&gt;comments.comment_post_ID =<br />
$wpdb-&gt;posts.ID)<br />
WHERE comment_approved = '1' AND comment_type = '' AND<br />
post_password = ''<br />
ORDER BY comment_date_gmt DESC<br />
LIMIT 10";<br />
$comments = $wpdb-&gt;get_results($sql);<br />
$output = $pre_HTML;<br />
$output .= "\n&lt;ul&gt;";<br />
foreach ($comments as $comment) {<br />
$output .= "\n&lt;li&gt;".strip_tags($comment-&gt;comment_author)<br />
.":" . "&lt;a href=\"" . get_permalink($comment-&gt;ID) .<br />
"#comment-" . $comment-&gt;comment_ID . "\" title=\"on " .<br />
$comment-&gt;post_title . "\"&gt;" . strip_tags($comment-&gt;com_excerpt)<br />
."&lt;/a&gt;&lt;/li&gt;";<br />
}<br />
$output .= "\n&lt;/ul&gt;";<br />
$output .= $post_HTML;<br />
echo $output;?&gt;</code></p>
<h3>Displaying Top Comments</h3>
<p><code>&lt;?php $result = $wpdb-&gt;get_results("SELECT comment_count,ID,post_title FROM $wpdb-&gt;posts ORDER BY comment_count DESC LIMIT 0 , 10");<br />
foreach ($result as $topten) {<br />
$postid = $topten-&gt;ID;<br />
$title = $topten-&gt;post_title;<br />
$commentcount = $topten-&gt;comment_count;<br />
if ($commentcount != 0) { ?&gt;<br />
&lt;li&gt;&lt;a href="&lt;?php echo get_permalink($postid); ?&gt;" title="&lt;?php echo $title ?&gt;"&gt;&lt;?php echo $title ?&gt;&lt;/a&gt;&lt;/li&gt;<br />
&lt;?php } } ?&gt;</code></p>
<img src="http://blogtuts.com/?ak_action=api_record_view&id=49&type=feed" alt="" />

<div class="posts"><h3>Related Posts</h3></div><ul><li><a href='http://blogtuts.com/code-displaying-updated-posts-in-wordpress/' rel='bookmark' title='Permanent Link: Code: Displaying Updated Posts in WordPress'>Code: Displaying Updated Posts in WordPress</a></li>
<li><a href='http://blogtuts.com/separating-trackbacks-and-comments-in-wordpress-2-7/' rel='bookmark' title='Permanent Link: Separating Trackbacks and Comments in WordPress 2.7+'>Separating Trackbacks and Comments in WordPress 2.7+</a></li>
<li><a href='http://blogtuts.com/code-how-to-display-recent-posts-in-wordpress/' rel='bookmark' title='Permanent Link: Code:  How to Display Recent Posts in WordPress'>Code:  How to Display Recent Posts in WordPress</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://blogtuts.com/wordpress-code-recent-comments-top-commentators/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Code: Displaying Updated Posts in WordPress</title>
		<link>http://blogtuts.com/code-displaying-updated-posts-in-wordpress/</link>
		<comments>http://blogtuts.com/code-displaying-updated-posts-in-wordpress/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 21:41:08 +0000</pubDate>
		<dc:creator>Kyle Eslick</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[Updated Posts]]></category>
		<category><![CDATA[WordPress Code]]></category>

		<guid isPermaLink="false">http://blogtuts.com/?p=46</guid>
		<description><![CDATA[In the past we&#8217;ve discussed how to add recent posts to your WordPress blog manually using code, but for blogs that are regularly updating older posts (there are a surprising number of these), here is some code that you can instead use to only show the most recently updated posts in WordPress! Here is the [...]

<div class="posts"><h3>Related Posts</h3></div><ul><li><a href='http://blogtuts.com/wordpress-code-recent-comments-top-commentators/' rel='bookmark' title='Permanent Link: Code: Add Recent Comments and Top Comments to WordPress'>Code: Add Recent Comments and Top Comments to WordPress</a></li>
<li><a href='http://blogtuts.com/code-how-to-display-recent-posts-in-wordpress/' rel='bookmark' title='Permanent Link: Code:  How to Display Recent Posts in WordPress'>Code:  How to Display Recent Posts in WordPress</a></li>
<li><a href='http://blogtuts.com/wordpress-code-category-archives/' rel='bookmark' title='Permanent Link: Code: Display Categories and Archives in WordPress'>Code: Display Categories and Archives in WordPress</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>In the past we&#8217;ve discussed <a href="http://blogtuts.com/code-how-to-display-recent-posts-in-wordpress/">how to add recent posts to your WordPress blog</a> manually using code, but for blogs that are regularly updating older posts (there are a surprising number of these), here is some code that you can instead use to only show the most recently updated posts in WordPress!</p>
<p>Here is the code you&#8217;ll want to place in your sidebar.php file where you want the updated posts to display:<span id="more-46"></span></p>
<p><code>&lt;?php<br />
$today = current_time('mysql', 1);<br />
$howMany = 5; //Number of posts you want to display<br />
if ( $recentposts = $wpdb-&gt;get_results("SELECT ID, post_title FROM $wpdb-&gt;posts WHERE post_status = 'publish' AND post_modified_gmt &lt; '$today' ORDER BY post_modified_gmt DESC LIMIT $howMany")):<br />
?&gt;<br />
&lt;h2&gt;&lt;?php _e("Recent Updates"); ?&gt;&lt;/h2&gt;<br />
&lt;ul&gt;<br />
&lt;?php<br />
foreach ($recentposts as $post) {<br />
if ($post-&gt;post_title == '') $post-&gt;post_title = sprintf(__('Post #%s'), $post-&gt;ID);<br />
echo "&lt;li&gt;&lt;a href='".get_permalink($post-&gt;ID)."'&gt;";<br />
the_title();<br />
echo '&lt;/a&gt;&lt;/li&gt;';<br />
}<br />
?&gt;<br />
&lt;/ul&gt;<br />
&lt;?php endif; ?&gt;</code></p>
<img src="http://blogtuts.com/?ak_action=api_record_view&id=46&type=feed" alt="" />

<div class="posts"><h3>Related Posts</h3></div><ul><li><a href='http://blogtuts.com/wordpress-code-recent-comments-top-commentators/' rel='bookmark' title='Permanent Link: Code: Add Recent Comments and Top Comments to WordPress'>Code: Add Recent Comments and Top Comments to WordPress</a></li>
<li><a href='http://blogtuts.com/code-how-to-display-recent-posts-in-wordpress/' rel='bookmark' title='Permanent Link: Code:  How to Display Recent Posts in WordPress'>Code:  How to Display Recent Posts in WordPress</a></li>
<li><a href='http://blogtuts.com/wordpress-code-category-archives/' rel='bookmark' title='Permanent Link: Code: Display Categories and Archives in WordPress'>Code: Display Categories and Archives in WordPress</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://blogtuts.com/code-displaying-updated-posts-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Code:  How to Display Recent Posts in WordPress</title>
		<link>http://blogtuts.com/code-how-to-display-recent-posts-in-wordpress/</link>
		<comments>http://blogtuts.com/code-how-to-display-recent-posts-in-wordpress/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 21:36:09 +0000</pubDate>
		<dc:creator>Kyle Eslick</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Recent Posts]]></category>
		<category><![CDATA[WordPress Code]]></category>

		<guid isPermaLink="false">http://blogtuts.com/?p=43</guid>
		<description><![CDATA[Although most current WordPress installations include a widget for displaying recent posts, there are quite a few people that prefer to get their hands dirty and manually code things.   If you&#8217;d like to learn how to display recent posts in WordPress, you&#8217;ve come to the right place! Here is the code you&#8217;ll need to display [...]

<div class="posts"><h3>Related Posts</h3></div><ul><li><a href='http://blogtuts.com/code-displaying-updated-posts-in-wordpress/' rel='bookmark' title='Permanent Link: Code: Displaying Updated Posts in WordPress'>Code: Displaying Updated Posts in WordPress</a></li>
<li><a href='http://blogtuts.com/wordpress-code-category-archives/' rel='bookmark' title='Permanent Link: Code: Display Categories and Archives in WordPress'>Code: Display Categories and Archives in WordPress</a></li>
<li><a href='http://blogtuts.com/wordpress-code-recent-comments-top-commentators/' rel='bookmark' title='Permanent Link: Code: Add Recent Comments and Top Comments to WordPress'>Code: Add Recent Comments and Top Comments to WordPress</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>Although most current WordPress installations include a widget for displaying recent posts, there are quite a few people that prefer to get their hands dirty and manually code things.   If you&#8217;d like to learn how to display recent posts in WordPress, you&#8217;ve come to the right place!</p>
<p>Here is the code you&#8217;ll need to display recent posts.  Simply copy the following code and place it in your sidebar.php file where you want the recent posts to be displayed!<span id="more-43"></span></p>
<p><code>&lt;?php query_posts('showposts=5'); ?&gt;<br />
&lt;ul&gt;<br />
&lt;?php while (have_posts()) : the_post(); ?&gt;<br />
&lt;li&gt;&lt;a href="&lt;?php the_permalink() ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/li&gt;<br />
&lt;?php endwhile;?&gt;<br />
&lt;/ul&gt;</code></p>
<img src="http://blogtuts.com/?ak_action=api_record_view&id=43&type=feed" alt="" />

<div class="posts"><h3>Related Posts</h3></div><ul><li><a href='http://blogtuts.com/code-displaying-updated-posts-in-wordpress/' rel='bookmark' title='Permanent Link: Code: Displaying Updated Posts in WordPress'>Code: Displaying Updated Posts in WordPress</a></li>
<li><a href='http://blogtuts.com/wordpress-code-category-archives/' rel='bookmark' title='Permanent Link: Code: Display Categories and Archives in WordPress'>Code: Display Categories and Archives in WordPress</a></li>
<li><a href='http://blogtuts.com/wordpress-code-recent-comments-top-commentators/' rel='bookmark' title='Permanent Link: Code: Add Recent Comments and Top Comments to WordPress'>Code: Add Recent Comments and Top Comments to WordPress</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://blogtuts.com/code-how-to-display-recent-posts-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Code: Add a &#8220;Tweet This&#8221; Button</title>
		<link>http://blogtuts.com/twitter-tweet-this-button-code/</link>
		<comments>http://blogtuts.com/twitter-tweet-this-button-code/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 21:05:05 +0000</pubDate>
		<dc:creator>Kyle Eslick</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Tweet Link]]></category>
		<category><![CDATA[Tweet This]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[Twitter Code]]></category>
		<category><![CDATA[Twitter Link]]></category>

		<guid isPermaLink="false">http://blogtuts.com/?p=41</guid>
		<description><![CDATA[Twitter has taken the blogosphere by storm over the past year, causing many bloggers to look for ways to leverage additional traffic from others who use Twitter.     One of the best ways we&#8217;ve found to accomplish this is to add a &#8220;tweet this&#8221; link below your blog&#8217;s posts as a reminder to your readers to share what they just [...]

<div class="posts"><h3>Related Posts</h3></div><ul><li><a href='http://blogtuts.com/most-recent-twitter-entry-wordpress-code/' rel='bookmark' title='Permanent Link: How-To: Display Most Recent Twitter Entry on Your WordPress Blog'>How-To: Display Most Recent Twitter Entry on Your WordPress Blog</a></li>
<li><a href='http://blogtuts.com/email-this-button-code/' rel='bookmark' title='Permanent Link: Code: Add an &#8220;Email This&#8221; Button'>Code: Add an &#8220;Email This&#8221; Button</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p><a href="http://twitter.com/">Twitter</a> has taken the blogosphere by storm over the past year, causing many bloggers to look for ways to leverage additional traffic from others who use Twitter.     One of the best ways we&#8217;ve found to accomplish this is to add a &#8220;tweet this&#8221; link below your blog&#8217;s posts as a reminder to your readers to share what they just read with others!</p>
<p>If you&#8217;d like to add a &#8220;tweet this&#8221; button to your blog, it is extremely easy!   Here is the code you&#8217;ll want to use: <span id="more-41"></span></p>
<p><code>&lt;a href="http://twitter.com/home?status=Currently reading &lt;?php the_permalink(); ?&gt;" title="Click to send this page to Twitter!" target="_blank"&gt;Tweet This!&lt;/a&gt;</code></p>
<p>Simply place that code below the content on your single post file where you want your new tweet this link to appear!</p>
<img src="http://blogtuts.com/?ak_action=api_record_view&id=41&type=feed" alt="" />

<div class="posts"><h3>Related Posts</h3></div><ul><li><a href='http://blogtuts.com/most-recent-twitter-entry-wordpress-code/' rel='bookmark' title='Permanent Link: How-To: Display Most Recent Twitter Entry on Your WordPress Blog'>How-To: Display Most Recent Twitter Entry on Your WordPress Blog</a></li>
<li><a href='http://blogtuts.com/email-this-button-code/' rel='bookmark' title='Permanent Link: Code: Add an &#8220;Email This&#8221; Button'>Code: Add an &#8220;Email This&#8221; Button</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://blogtuts.com/twitter-tweet-this-button-code/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Code: Add an &#8220;Email This&#8221; Button</title>
		<link>http://blogtuts.com/email-this-button-code/</link>
		<comments>http://blogtuts.com/email-this-button-code/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 20:52:13 +0000</pubDate>
		<dc:creator>Kyle Eslick</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Blog Code]]></category>
		<category><![CDATA[Email Button]]></category>
		<category><![CDATA[Email This]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[WordPress Code]]></category>

		<guid isPermaLink="false">http://blogtuts.com/?p=38</guid>
		<description><![CDATA[When building a blog that offers a lot of useful content and resources (rather than opinion), we strongly recommend blogs offer an easy way for readers/users to email your content to their friends and family. If you&#8217;d like to do this on your blog, this is actually pretty easy!   The following code is designed to allow readers to click on the button and [...]

<div class="posts"><h3>Related Posts</h3></div><ul><li><a href='http://blogtuts.com/twitter-tweet-this-button-code/' rel='bookmark' title='Permanent Link: Code: Add a &#8220;Tweet This&#8221; Button'>Code: Add a &#8220;Tweet This&#8221; Button</a></li>
<li><a href='http://blogtuts.com/add-print-this-button/' rel='bookmark' title='Permanent Link: Code: Add A &#8220;Print This&#8221; Button'>Code: Add A &#8220;Print This&#8221; Button</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>When building a blog that offers a lot of useful content and resources (rather than opinion), we strongly recommend blogs offer an easy way for readers/users to email your content to their friends and family.</p>
<p>If you&#8217;d like to do this on your blog, this is actually pretty easy!   The following code is designed to allow readers to click on the button and have it open up their default email software. It wil even create a subject and link that points to the post the reader is currently visiting!   Here is the javascript code you will need:<span id="more-38"></span></p>
<p><code>&lt;script type="text/javascript"&gt;<br />
&lt;!-- Begin<br />
function isPPC() {<br />
if (navigator.appVersion.indexOf("PPC") != -1) return true;<br />
else return false;<br />
}<br />
if(isPPC()) {<br />
document.write('&lt;a HREF=\"mailto:\?subject\=Take a look at this page I found, ' + document.title + '?body=You can see this page at: ' + window.location + '\" onMouseOver="window.status=\'Send your friends e-mail about this page\'; return true" TITLE="Send your friends e-mail about this page"&gt;Email to a Friend&lt;\/a&gt;');<br />
}<br />
else { document.write('&lt;a HREF=\"mailto:\?body\=Take a look at this page I found titled ' + document.title + '. You can see this page at: ' + window.location + '\" onMouseOver="window.status=\'Send your friends e-mail about this page\'; return true" TITLE="Send your friends e-mail about this page" rel="nofollow"&gt;Email This!&lt;\/a&gt;');<br />
}<br />
// End --&gt;<br />
&lt;/script&gt;</code></p>
<p>This code will create an &#8220;email this&#8221; link on your blog, allowing your readers to simply enter in someone&#8217;s email address and click send to share your content with others.</p>
<img src="http://blogtuts.com/?ak_action=api_record_view&id=38&type=feed" alt="" />

<div class="posts"><h3>Related Posts</h3></div><ul><li><a href='http://blogtuts.com/twitter-tweet-this-button-code/' rel='bookmark' title='Permanent Link: Code: Add a &#8220;Tweet This&#8221; Button'>Code: Add a &#8220;Tweet This&#8221; Button</a></li>
<li><a href='http://blogtuts.com/add-print-this-button/' rel='bookmark' title='Permanent Link: Code: Add A &#8220;Print This&#8221; Button'>Code: Add A &#8220;Print This&#8221; Button</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://blogtuts.com/email-this-button-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Code: Add A &#8220;Print This&#8221; Button</title>
		<link>http://blogtuts.com/add-print-this-button/</link>
		<comments>http://blogtuts.com/add-print-this-button/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 17:29:01 +0000</pubDate>
		<dc:creator>Kyle Eslick</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Print Javascript]]></category>
		<category><![CDATA[Print This]]></category>
		<category><![CDATA[WordPress Code]]></category>
		<category><![CDATA[WordPress Tutorials]]></category>

		<guid isPermaLink="false">http://blogtuts.com/?p=21</guid>
		<description><![CDATA[Want to make it easy for your readers to be able to print your blog&#8217;s content?    Adding a &#8220;Print This&#8221; button below your blog&#8217;s posts can serve as a great visual cue to readers to remind them to print your content. If you&#8217;d like to add something like this to your blog, first you&#8217;ll want to [...]

<div class="posts"><h3>Related Posts</h3></div><ul><li><a href='http://blogtuts.com/email-this-button-code/' rel='bookmark' title='Permanent Link: Code: Add an &#8220;Email This&#8221; Button'>Code: Add an &#8220;Email This&#8221; Button</a></li>
<li><a href='http://blogtuts.com/wordpress-print-stylesheet/' rel='bookmark' title='Permanent Link: WordPress Tutorial: Building a Print Stylesheet'>WordPress Tutorial: Building a Print Stylesheet</a></li>
<li><a href='http://blogtuts.com/code-adding-edit-buttons-to-wordpress/' rel='bookmark' title='Permanent Link: Code: Adding Edit Buttons to WordPress'>Code: Adding Edit Buttons to WordPress</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>Want to make it easy for your readers to be able to print your blog&#8217;s content?    Adding a &#8220;Print This&#8221; button below your blog&#8217;s posts can serve as a great visual cue to readers to remind them to print your content.</p>
<p>If you&#8217;d like to add something like this to your blog, first you&#8217;ll want to make sure your blog&#8217;s theme has a print stylesheet loaded, then simply add the following bit of Javascript code where you want your print button to be:<span id="more-21"></span></p>
<p><code>&lt;a href="javascript:window.print()" rel="nofollow"&gt;Print This!&lt;/a&gt;&lt;/span&gt;</code></p>
<p>You&#8217;ll want to make sure you only place this button on your individual post pages, as it prints whichever page it is clicked on.  If you place it on the homepage and a reader uses it, it will print the entire page instead of just that post!</p>
<img src="http://blogtuts.com/?ak_action=api_record_view&id=21&type=feed" alt="" />

<div class="posts"><h3>Related Posts</h3></div><ul><li><a href='http://blogtuts.com/email-this-button-code/' rel='bookmark' title='Permanent Link: Code: Add an &#8220;Email This&#8221; Button'>Code: Add an &#8220;Email This&#8221; Button</a></li>
<li><a href='http://blogtuts.com/wordpress-print-stylesheet/' rel='bookmark' title='Permanent Link: WordPress Tutorial: Building a Print Stylesheet'>WordPress Tutorial: Building a Print Stylesheet</a></li>
<li><a href='http://blogtuts.com/code-adding-edit-buttons-to-wordpress/' rel='bookmark' title='Permanent Link: Code: Adding Edit Buttons to WordPress'>Code: Adding Edit Buttons to WordPress</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://blogtuts.com/add-print-this-button/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
