<?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; WordPress Tutorials</title>
	<atom:link href="http://blogtuts.com/category/blog-tutorials/wordpress-tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogtuts.com</link>
	<description>Blog Tutorials, Tools, and Resources</description>
	<lastBuildDate>Thu, 04 Nov 2010 20:41:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Separating Trackbacks and Comments in WordPress 2.7+</title>
		<link>http://blogtuts.com/separating-trackbacks-and-comments-in-wordpress-2-7/</link>
		<comments>http://blogtuts.com/separating-trackbacks-and-comments-in-wordpress-2-7/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 16:19:43 +0000</pubDate>
		<dc:creator>Kyle Eslick</dc:creator>
				<category><![CDATA[How-To]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[WordPress Code]]></category>
		<category><![CDATA[WordPress Comments]]></category>
		<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[WordPress Pingbacks]]></category>
		<category><![CDATA[WordPress Tips]]></category>
		<category><![CDATA[WordPress Trackbacks]]></category>

		<guid isPermaLink="false">http://blogtuts.com/?p=124</guid>
		<description><![CDATA[Interested in separating your trackbacks and comments on your WordPress blog?   This blog tutorial should have you covered, whether you use a modern WordPress installation, or an older (pre 2.7) version of WordPress.   Below you&#8217;ll find we&#8217;ve put together a tutorial for both types of comment loops. For WordPress 2.7+ Installations Locate the following code [...]<div class="posts"><h3>Related Posts</h3></div><ul>
<li><a href='http://blogtuts.com/wordpress-code-recent-comments-top-commentators/' rel='bookmark' title='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-adding-edit-buttons-to-wordpress/' rel='bookmark' title='Code: Adding Edit Buttons to WordPress'>Code: Adding Edit Buttons to WordPress</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>Interested in separating your trackbacks and comments on your WordPress blog?   This <a href="http://blogtuts.com/">blog tutorial</a> should have you covered, whether you use a modern WordPress installation, or an older (pre 2.7) version of WordPress.   Below you&#8217;ll find we&#8217;ve put together a tutorial for both types of comment loops.</p>
<h3><strong>For WordPress 2.7+ Installations</strong></h3>
<p>Locate the following code in your index.php or single.php file (whichever file your theme uses to show single post pages):</p>
<p><code>&lt;?php comments_template(); ?&gt;</code></p>
<p><strong>Replace</strong> that code with the following:</p>
<p><code>&lt;?php comments_template('', true); ?&gt;</code></p>
<p>That is it for that file.   Now go to your <strong>comments.php</strong> file and locate the following code:</p>
<p><code>&lt;?php if ( have_comments() ) : ?&gt;</code></p>
<p>Immediately <strong>below</strong> that code, insert the following code:</p>
<p><code>&lt;?php if ( ! empty($comments_by_type['comment']) ) : ?&gt;</code></p>
<p>Okay, once that is done, you&#8217;ll next need to scroll down a little further (still in the comments.php file) and locate the following code:</p>
<p><code>&lt;?php wp_list_comments(); ?&gt;</code></p>
<p>You&#8217;ll want to <strong>replace</strong> that code with the below code:</p>
<p><code>&lt;?php wp_list_comments('type=comment'); ?&gt;</code></p>
<p>Immediately below this function you should see the following code:</p>
<p><code>&lt;/ol&gt;</code></p>
<p>Directly <strong>below</strong> that code, place the following code:</p>
<p><code>&lt;?php endif; ?&gt;</code></p>
<p>That should take care of the comment loop.  The last step is to insert the code which will display the trackbacks/pingbacks.  This can be placed anywhere below the code we just hacked above:</p>
<p><code>&lt;?php if ( ! empty($comments_by_type['pings']) ) : ?&gt;<br />
&lt;h3 id="pings"&gt;Trackbacks/Pingbacks&lt;/h3&gt;<br />
&lt;ol&gt;<br />
&lt;?php wp_list_comments('type=pings'); ?&gt;<br />
&lt;/ol&gt;<br />
&lt;?php endif; ?&gt;</code></p>
<p>Some people prefer to display their trackbacks and pingbacks below the comment form or somewhere else out of the way, so this is really up to you!  Just place the above code where you want to show them.   If you don&#8217;t like them showing at all on your blog, just don&#8217;t place the above code at all.</p>
<p>Once that is done, it is time to give it a try.  Check it out on your blog and let us know how everything turns out!</p>
<h3><strong>For Pre-WordPress 2.7 Installations:</strong></h3>
<p>Prior to WordPress 2.7, the comment form wasn&#8217;t nearly as functional as it is with the newer versions and also included a lot more code, but it is still possible to separate the trackbacks and comments using the old comment loop.     If you&#8217;d like to separate your trackbacks from your comments on a WordPress 2.6 or earlier installation, here is the steps you&#8217;ll need to take.</p>
<p>First, access your comments.php file and grab the following code:</p>
<p><code>&lt;?php foreach ($comments as $comment) : ?&gt;</code></p>
<p>Immediately <strong>after</strong> the above code, you&#8217;ll want to place the following code:</p>
<p><code>&lt;?php $comment_type = get_comment_type(); ?&gt;<br />
&lt;?php if($comment_type == 'comment') { ?&gt;</code></p>
<p>Next, scroll down a little bit and locate the following code:</p>
<p><code>&lt;?php endforeach; /* end for each comment */ ?&gt;</code></p>
<p>Immediately <strong>before</strong> the above code, you&#8217;ll want to place this code:</p>
<p><code>&lt;?php } /* End of is_comment statement */ ?&gt;</code></p>
<p>This will filter out all of the trackbacks and pingbacks from your main comments loop. Now we need to create a second comments loop to display the trackbacks and pingbacks.  Almost immediately below the code from step 2 you should find this code:</p>
<p><code>&lt;?php else : // this is displayed if there are no comments so far ?&gt;</code></p>
<p>Immediately <strong>before</strong> the above code, you&#8217;ll want to place this code:</p>
<p><code>&lt;h3&gt;Trackbacks&lt;/h3&gt;<br />
&lt;ol&gt;<br />
&lt;?php foreach ($comments as $comment) : ?&gt;<br />
&lt;?php $comment_type = get_comment_type(); ?&gt;<br />
&lt;?php if($comment_type != 'comment') { ?&gt;<br />
&lt;li&gt;&lt;?php comment_author_link() ?&gt;&lt;/li&gt;<br />
&lt;?php } ?&gt;<br />
&lt;?php endforeach; ?&gt;<br />
&lt;/ol&gt;</code></p>
<p>You can adjust this code to display how you want to, including using a different header if you have a specific look for your header 3.</p>
<p>If you&#8217;ve tried this tutorial, let us know how it worked for you in the comments!</p>
<div class="posts"><h3>Related Posts</h3></div><ul>
<li><a href='http://blogtuts.com/wordpress-code-recent-comments-top-commentators/' rel='bookmark' title='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-adding-edit-buttons-to-wordpress/' rel='bookmark' title='Code: Adding Edit Buttons to WordPress'>Code: Adding Edit Buttons to WordPress</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://blogtuts.com/separating-trackbacks-and-comments-in-wordpress-2-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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/code-how-to-display-recent-posts-in-wordpress/' rel='bookmark' title='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='Code: Display Categories and Archives in WordPress'>Code: Display Categories and Archives in WordPress</a></li>
<li><a href='http://blogtuts.com/code-adding-edit-buttons-to-wordpress/' rel='bookmark' title='Code: Adding Edit Buttons to WordPress'>Code: Adding Edit Buttons to 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>
<div class="posts"><h3>Related Posts</h3></div><ul>
<li><a href='http://blogtuts.com/code-how-to-display-recent-posts-in-wordpress/' rel='bookmark' title='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='Code: Display Categories and Archives in WordPress'>Code: Display Categories and Archives in WordPress</a></li>
<li><a href='http://blogtuts.com/code-adding-edit-buttons-to-wordpress/' rel='bookmark' title='Code: Adding Edit Buttons to WordPress'>Code: Adding Edit Buttons to 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>How-To: Display Most Recent Twitter Entry on Your WordPress Blog</title>
		<link>http://blogtuts.com/most-recent-twitter-entry-wordpress-code/</link>
		<comments>http://blogtuts.com/most-recent-twitter-entry-wordpress-code/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 13:22:59 +0000</pubDate>
		<dc:creator>Kyle Eslick</dc:creator>
				<category><![CDATA[How-To]]></category>
		<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[Most Recent Tweets]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[Twitter Code]]></category>
		<category><![CDATA[Twitter WordPress]]></category>
		<category><![CDATA[WordPress Tutorial]]></category>

		<guid isPermaLink="false">http://blogtuts.com/?p=75</guid>
		<description><![CDATA[Proud of your tweets?   Maybe you run a business blog and would like to integrate your Twitter feed?   For WordPress users, adding your most recent tweet to your WordPress blog is actually very easy.   Simply add a little code snippet in your blog&#8217;s sidebar where you want to display your most recent tweet, then add [...]<div class="posts"><h3>Related Posts</h3></div><ul>
<li><a href='http://blogtuts.com/twitter-tweet-this-button-code/' rel='bookmark' title='Code: Add a &#8220;Tweet This&#8221; Button'>Code: Add a &#8220;Tweet This&#8221; Button</a></li>
<li><a href='http://blogtuts.com/code-how-to-display-recent-posts-in-wordpress/' rel='bookmark' title='Code:  How to Display Recent Posts in WordPress'>Code:  How to Display Recent Posts in WordPress</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>Proud of your tweets?   Maybe you run a business blog and would like to integrate your Twitter feed?   For WordPress users, adding your most recent tweet to your WordPress blog is actually very easy.   Simply add a little code snippet in your blog&#8217;s sidebar where you want to display your most recent tweet, then add your Twitter username!</p>
<p>Here is the code you’ll need to easily add the most recent Twitter entry:<span id="more-75"></span></p>
<p><code>&lt;?php<br />
// Your twitter username.<br />
$username = "TwitterUsername";<br />
// Prefix - some text you want displayed before your latest tweet.<br />
// (HTML is OK, but be sure to escape quotes with backslashes: for example href=\"link.html\")<br />
$prefix = "";<br />
// Suffix - some text you want display after your latest tweet. (Same rules as the prefix.)<br />
$suffix = "";<br />
$feed = "http://search.twitter.com/search.atom?q=from:" . $username . "&amp;rpp=1";<br />
function parse_feed($feed) {<br />
$stepOne = explode("&lt;content type=\"html\"&gt;", $feed);<br />
$stepTwo = explode("&lt;/content&gt;", $stepOne[1]);<br />
$tweet = $stepTwo[0];<br />
$tweet = str_replace(”&amp;lt;”, “&lt;”, $tweet);<br />
$tweet = str_replace(”&amp;gt;”, “&gt;”, $tweet);<br />
return $tweet;<br />
}<br />
$twitterFeed = file_get_contents($feed);<br />
echo stripslashes($prefix) . parse_feed($twitterFeed) . stripslashes($suffix);<br />
?&gt;</code></p>
<p>Simply add your Twitter username where it says &#8220;TwitterUsername&#8221; in the code above!</p>
<div class="posts"><h3>Related Posts</h3></div><ul>
<li><a href='http://blogtuts.com/twitter-tweet-this-button-code/' rel='bookmark' title='Code: Add a &#8220;Tweet This&#8221; Button'>Code: Add a &#8220;Tweet This&#8221; Button</a></li>
<li><a href='http://blogtuts.com/code-how-to-display-recent-posts-in-wordpress/' rel='bookmark' title='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/most-recent-twitter-entry-wordpress-code/feed/</wfw:commentRss>
		<slash:comments>2</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/wordpress-code-recent-comments-top-commentators/' rel='bookmark' title='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/last-modified-date-code-wordpress/' rel='bookmark' title='Code: Display Last Modified Date in WordPress'>Code: Display Last Modified Date in 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>
<div class="posts"><h3>Related Posts</h3></div><ul>
<li><a href='http://blogtuts.com/wordpress-code-recent-comments-top-commentators/' rel='bookmark' title='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/last-modified-date-code-wordpress/' rel='bookmark' title='Code: Display Last Modified Date in WordPress'>Code: Display Last Modified Date in 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/code-how-to-display-recent-posts-in-wordpress/' rel='bookmark' title='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='Code: Displaying Updated Posts in WordPress'>Code: Displaying Updated Posts in WordPress</a></li>
<li><a href='http://blogtuts.com/wordpress-code-recent-comments-top-commentators/' rel='bookmark' title='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 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>
<div class="posts"><h3>Related Posts</h3></div><ul>
<li><a href='http://blogtuts.com/code-how-to-display-recent-posts-in-wordpress/' rel='bookmark' title='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='Code: Displaying Updated Posts in WordPress'>Code: Displaying Updated Posts in WordPress</a></li>
<li><a href='http://blogtuts.com/wordpress-code-recent-comments-top-commentators/' rel='bookmark' title='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/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='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='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='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>
<div class="posts"><h3>Related Posts</h3></div><ul>
<li><a href='http://blogtuts.com/code-displaying-updated-posts-in-wordpress/' rel='bookmark' title='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='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='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/code-how-to-display-recent-posts-in-wordpress/' rel='bookmark' title='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-recent-comments-top-commentators/' rel='bookmark' title='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/wordpress-code-category-archives/' rel='bookmark' title='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>
<div class="posts"><h3>Related Posts</h3></div><ul>
<li><a href='http://blogtuts.com/code-how-to-display-recent-posts-in-wordpress/' rel='bookmark' title='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-recent-comments-top-commentators/' rel='bookmark' title='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/wordpress-code-category-archives/' rel='bookmark' title='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='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='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='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>
<div class="posts"><h3>Related Posts</h3></div><ul>
<li><a href='http://blogtuts.com/code-displaying-updated-posts-in-wordpress/' rel='bookmark' title='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='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='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>WordPress Tutorial: Building a Print Stylesheet</title>
		<link>http://blogtuts.com/wordpress-print-stylesheet/</link>
		<comments>http://blogtuts.com/wordpress-print-stylesheet/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 15:59:52 +0000</pubDate>
		<dc:creator>Kyle Eslick</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[Print Stylesheet]]></category>
		<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[WordPress Stylesheet]]></category>
		<category><![CDATA[WordPress Tips]]></category>

		<guid isPermaLink="false">http://blogtuts.com/?p=16</guid>
		<description><![CDATA[As the internet continues to grow as a source for news and information, there is a growing need for websites and blogs to be printer-friendly.  Whether you run a news site, a recipe blog, or simply offer your opinions to your readers, it is inevitable that people will want to print your content.  Unfortunately, many [...]<div class="posts"><h3>Related Posts</h3></div><ul>
<li><a href='http://blogtuts.com/add-print-this-button/' rel='bookmark' title='Code: Add A &#8220;Print This&#8221; Button'>Code: Add A &#8220;Print This&#8221; Button</a></li>
<li><a href='http://blogtuts.com/separating-trackbacks-and-comments-in-wordpress-2-7/' rel='bookmark' title='Separating Trackbacks and Comments in WordPress 2.7+'>Separating Trackbacks and Comments in WordPress 2.7+</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>As the internet continues to grow as a source for news and information, there is a growing need for websites and blogs to be printer-friendly.  Whether you run a news site, a recipe blog, or simply offer your opinions to your readers, it is inevitable that people will want to print your content. </p>
<p>Unfortunately, many web designers aren&#8217;t including separate stylesheets for printers with their designs.  As a result, we decided to write this tutorial to explain how to create a print stylesheet.   Due to most of our readers being on WordPress, we will place our focus there, though this can be adapted for just about any blogging platform!<span id="more-16"></span></p>
<h3><strong>What is a Print Stylesheet?</strong></h3>
<p>Lets start with the definition so you know what we are talking about.  A print stylesheet is an alternate stylesheet for a website or blog that your website will use whenever someone attempts to print a page off of your blog instead of the standard stylesheet.</p>
<h3><strong>How Does a Print Stylesheet Work?</strong></h3>
<p>A print stylesheet overrides any designated style.css code when someone attempts to print a page off of your website.  If a print stylesheet is created correctly, people printing a webpage will avoid printing the unnecessary elements, such as the header, footer, and sidebars.</p>
<h3><strong>How do I Make a Print Stylesheet?</strong></h3>
<p>First thing you need to do create your print.css file. This can be done by taking a blank Notepad (or equivalent) file and naming it print.css.  You can also make a copy of your blog&#8217;s style.css file and rename it, then remove the code within the copy.</p>
<h3><strong>What Code Do I Put Into My Print Stylesheet?</strong></h3>
<p>Depending on the setup of the theme your blog is using, this step will either be pretty easy or incredibly difficult.  Basically, we don&#8217;t want things like your header or sidebars to appear in your print stylesheet, so you&#8217;ll want to setup your print stylesheet to remove these elements:</p>
<p><code>#header, #nav, #sidebar, #footer .noprint {display: none;}</code></p>
<p>Depending on how the div id&#8217;s are setup, what you put above will vary.  In other words, use the above as a guide, but customize it to match your theme.  You can also use this method to censor out images and other unwanted elements of your post pages (if applicable).  Lastly, if you have your contact information in your footer, you may want to consider leaving the footer on your prints.</p>
<p>Next, you will want to expand your content section so that it looks decent when printed, instead of the content margins your standard style.css uses.  It will probably look something like the following:</p>
<p><code>#content {width: 100%; margin: 0; float: none;}</code></p>
<p>Now, to ensure that alternate colors are not picked up when printed, you&#8217;ll want to do something like the following to make sure it prints using black ink:</p>
<p><code>a:link, a:visited {color: #000000}</code></p>
<p>Because most people use white paper, this should make your printouts better looking.</p>
<h3><strong>How To Tell Your Theme to Use the Print Stylesheet</strong></h3>
<p>Once you&#8217;ve built and uploaded your print stylesheet, the next step is of course to tell your theme to use it when someone prints something!  This is probably the easiest step of all!  You&#8217;ll want to simply paste the following code into your themes header file (we recommend placing it just below the standard style.css code):</p>
<p><code>&lt;link type="text/css" media="print" rel="stylesheet" href="&lt;?php bloginfo('template_url'); ?&gt;/print.css" /&gt;</code></p>
<p>So, there you go!  Hopefully if you&#8217;ve followed these steps, and uploaded your new print.css file to your WordPress blog&#8217;s theme, anything printed from your website will look much better.</p>
<div class="posts"><h3>Related Posts</h3></div><ul>
<li><a href='http://blogtuts.com/add-print-this-button/' rel='bookmark' title='Code: Add A &#8220;Print This&#8221; Button'>Code: Add A &#8220;Print This&#8221; Button</a></li>
<li><a href='http://blogtuts.com/separating-trackbacks-and-comments-in-wordpress-2-7/' rel='bookmark' title='Separating Trackbacks and Comments in WordPress 2.7+'>Separating Trackbacks and Comments in WordPress 2.7+</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://blogtuts.com/wordpress-print-stylesheet/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

