<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: WordPress: Display Recent, Related or Random Posts in Your Sidebar</title>
	<atom:link href="http://gunnerpress.com/wordpress/wordpress-display-recent-related-or-random-posts-in-your-sidebar/feed" rel="self" type="application/rss+xml" />
	<link>http://gunnerpress.com/wordpress/wordpress-display-recent-related-or-random-posts-in-your-sidebar</link>
	<description>once in a lifetime</description>
	<lastBuildDate>Fri, 16 Jul 2010 04:06:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Ivan Seminole</title>
		<link>http://gunnerpress.com/wordpress/wordpress-display-recent-related-or-random-posts-in-your-sidebar/comment-page-1#comment-431</link>
		<dc:creator>Ivan Seminole</dc:creator>
		<pubDate>Sun, 04 Jul 2010 18:39:21 +0000</pubDate>
		<guid isPermaLink="false">http://gunnerpress.com/?p=119#comment-431</guid>
		<description>I found this upon, an individual creating this, the idea had been what exactly for you to be searching for!</description>
		<content:encoded><![CDATA[<p>I found this upon, an individual creating this, the idea had been what exactly for you to be searching for!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dallin</title>
		<link>http://gunnerpress.com/wordpress/wordpress-display-recent-related-or-random-posts-in-your-sidebar/comment-page-1#comment-424</link>
		<dc:creator>Dallin</dc:creator>
		<pubDate>Wed, 05 May 2010 01:31:24 +0000</pubDate>
		<guid isPermaLink="false">http://gunnerpress.com/?p=119#comment-424</guid>
		<description>Hey guys I found a quick, free and easy answer to displaying random posts. http://wordpress.org/extend/plugins/random-posts-widget/ I just downloaded that plug in and it displays 5 random post in my side bar. Just thought I would share what i found. Thanks for the great post J Mohamed

Regards,

Dallin</description>
		<content:encoded><![CDATA[<p>Hey guys I found a quick, free and easy answer to displaying random posts. <a href="http://wordpress.org/extend/plugins/random-posts-widget/" rel="nofollow">http://wordpress.org/extend/plugins/random-posts-widget/</a> I just downloaded that plug in and it displays 5 random post in my side bar. Just thought I would share what i found. Thanks for the great post J Mohamed</p>
<p>Regards,</p>
<p>Dallin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gary Chambers</title>
		<link>http://gunnerpress.com/wordpress/wordpress-display-recent-related-or-random-posts-in-your-sidebar/comment-page-1#comment-413</link>
		<dc:creator>Gary Chambers</dc:creator>
		<pubDate>Sat, 06 Mar 2010 11:28:45 +0000</pubDate>
		<guid isPermaLink="false">http://gunnerpress.com/?p=119#comment-413</guid>
		<description>Hi just starting on WordPress could you advise on how to get this code working on the sidebar of my main site.  Many Thanks</description>
		<content:encoded><![CDATA[<p>Hi just starting on WordPress could you advise on how to get this code working on the sidebar of my main site.  Many Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: links for 2009-11-17 &#171; Free Open Source Directory</title>
		<link>http://gunnerpress.com/wordpress/wordpress-display-recent-related-or-random-posts-in-your-sidebar/comment-page-1#comment-311</link>
		<dc:creator>links for 2009-11-17 &#171; Free Open Source Directory</dc:creator>
		<pubDate>Wed, 18 Nov 2009 01:02:51 +0000</pubDate>
		<guid isPermaLink="false">http://gunnerpress.com/?p=119#comment-311</guid>
		<description>[...] WordPress: Display Recent, Related or Random Posts in Your Sidebar — gunnerpress.com WordPress: Display Recent, Related or Random Posts (tags: WordPress: Display Recent, Related or Random Posts) [...]</description>
		<content:encoded><![CDATA[<p>[...] WordPress: Display Recent, Related or Random Posts in Your Sidebar — gunnerpress.com WordPress: Display Recent, Related or Random Posts (tags: WordPress: Display Recent, Related or Random Posts) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: J Mehmett</title>
		<link>http://gunnerpress.com/wordpress/wordpress-display-recent-related-or-random-posts-in-your-sidebar/comment-page-1#comment-306</link>
		<dc:creator>J Mehmett</dc:creator>
		<pubDate>Wed, 21 Oct 2009 07:35:08 +0000</pubDate>
		<guid isPermaLink="false">http://gunnerpress.com/?p=119#comment-306</guid>
		<description>eDealz, this is a WordPress code and all the functions are involved in the WordPress core code. So this code has no way to work on non-WordPress platforms.</description>
		<content:encoded><![CDATA[<p>eDealz, this is a WordPress code and all the functions are involved in the WordPress core code. So this code has no way to work on non-WordPress platforms.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: eDealz</title>
		<link>http://gunnerpress.com/wordpress/wordpress-display-recent-related-or-random-posts-in-your-sidebar/comment-page-1#comment-301</link>
		<dc:creator>eDealz</dc:creator>
		<pubDate>Sat, 03 Oct 2009 10:09:16 +0000</pubDate>
		<guid isPermaLink="false">http://gunnerpress.com/?p=119#comment-301</guid>
		<description>Hi all,
I have been trying to get the wordpress recent posts to work on the homepage of my site (not wordpress site) and have failed many times trying with all the code from wordpress and from here too.

I have added the reuire wp blog header function and used the code within the page to display results. I do not get any errors - however the fact is that i get nothing?

The site uses smarty - anyone any ideas what the problem could be?</description>
		<content:encoded><![CDATA[<p>Hi all,<br />
I have been trying to get the wordpress recent posts to work on the homepage of my site (not wordpress site) and have failed many times trying with all the code from wordpress and from here too.</p>
<p>I have added the reuire wp blog header function and used the code within the page to display results. I do not get any errors &#8211; however the fact is that i get nothing?</p>
<p>The site uses smarty &#8211; anyone any ideas what the problem could be?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ultimate resources wordpress development tutorials &#124; blogfreakz.com</title>
		<link>http://gunnerpress.com/wordpress/wordpress-display-recent-related-or-random-posts-in-your-sidebar/comment-page-1#comment-294</link>
		<dc:creator>Ultimate resources wordpress development tutorials &#124; blogfreakz.com</dc:creator>
		<pubDate>Sun, 06 Sep 2009 10:44:04 +0000</pubDate>
		<guid isPermaLink="false">http://gunnerpress.com/?p=119#comment-294</guid>
		<description>[...] Source:http://gunnerpress.com/wordpress/wordpress-display-recent-related-or-random-posts-in-your-sidebar [...]</description>
		<content:encoded><![CDATA[<p>[...] Source:http://gunnerpress.com/wordpress/wordpress-display-recent-related-or-random-posts-in-your-sidebar [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: J Mehmett</title>
		<link>http://gunnerpress.com/wordpress/wordpress-display-recent-related-or-random-posts-in-your-sidebar/comment-page-1#comment-287</link>
		<dc:creator>J Mehmett</dc:creator>
		<pubDate>Sun, 16 Aug 2009 07:31:05 +0000</pubDate>
		<guid isPermaLink="false">http://gunnerpress.com/?p=119#comment-287</guid>
		<description>&lt;a href=&quot;http://gunnerpress.com/wordpress/wordpress-display-recent-related-or-random-posts-in-your-sidebar#comment-286&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;&lt;em&gt;Joe&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;, &lt;abbr title=&quot;Hypertext Preprocessor&quot;&gt;PHP&lt;/abbr&gt; code doesn&#039;t work in the &lt;abbr title=&quot;Hypertext Markup Language&quot;&gt;HTML&lt;/abbr&gt;/text widget. So you need to open your &lt;code&gt;sidebar.php&lt;/code&gt; file and paste your code there.

Hope it works for you.</description>
		<content:encoded><![CDATA[<p><a href="http://gunnerpress.com/wordpress/wordpress-display-recent-related-or-random-posts-in-your-sidebar#comment-286" rel="nofollow"><strong><em>Joe</em></strong></a>, <abbr title="Hypertext Preprocessor">PHP</abbr> code doesn&#8217;t work in the <abbr title="Hypertext Markup Language">HTML</abbr>/text widget. So you need to open your <code>sidebar.php</code> file and paste your code there.</p>
<p>Hope it works for you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joe</title>
		<link>http://gunnerpress.com/wordpress/wordpress-display-recent-related-or-random-posts-in-your-sidebar/comment-page-1#comment-286</link>
		<dc:creator>Joe</dc:creator>
		<pubDate>Sun, 16 Aug 2009 05:29:00 +0000</pubDate>
		<guid isPermaLink="false">http://gunnerpress.com/?p=119#comment-286</guid>
		<description>I&#039;m just getting the title and &#039;- posted on&#039;. Can this be added to my sidebar via a text widget? Or must it be added within the actual sidebar.php file?
 (I&#039;ve added other html links using the text widget but I don&#039;t know if php works in this area) . Thanks. Nice post too btw.</description>
		<content:encoded><![CDATA[<p>I&#8217;m just getting the title and &#8216;- posted on&#8217;. Can this be added to my sidebar via a text widget? Or must it be added within the actual sidebar.php file?<br />
 (I&#8217;ve added other html links using the text widget but I don&#8217;t know if php works in this area) . Thanks. Nice post too btw.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: J Mehmett</title>
		<link>http://gunnerpress.com/wordpress/wordpress-display-recent-related-or-random-posts-in-your-sidebar/comment-page-1#comment-283</link>
		<dc:creator>J Mehmett</dc:creator>
		<pubDate>Wed, 12 Aug 2009 05:29:09 +0000</pubDate>
		<guid isPermaLink="false">http://gunnerpress.com/?p=119#comment-283</guid>
		<description>&lt;a href=&quot;http://gunnerpress.com/wordpress/wordpress-display-recent-related-or-random-posts-in-your-sidebar/#comment-264&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;&lt;em&gt;Mikel&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;, I am very glad that you liked it. ;)

&lt;a href=&quot;http://gunnerpress.com/wordpress/wordpress-display-recent-related-or-random-posts-in-your-sidebar/#comment-273&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;&lt;em&gt;Dave Nalle&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;, please double-check your changes. The code published here is the same I used in my current sidebar.

&lt;a href=&quot;http://gunnerpress.com/wordpress/wordpress-display-recent-related-or-random-posts-in-your-sidebar/#comment-278&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;&lt;em&gt;Minea Adrian&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;, let me know what type of &lt;abbr title=&quot;Content Management System&quot;&gt;CMS&lt;/abbr&gt; you are using.



&lt;a href=&quot;http://gunnerpress.com/wordpress/wordpress-display-recent-related-or-random-posts-in-your-sidebar/#comment-281&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;&lt;em&gt;MK&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;, Sure, you can use random posts based on specific month. Replace this line:

&lt;pre&gt;&lt;code&gt;
&lt;?php $posts = get_posts(&#039;orderby=rand&amp;numberposts=3&#039;); foreach($posts as $post) { 
 // ...
}
?&gt;
&lt;/code&gt;&lt;/pre&gt;

...with:

&lt;pre&gt;&lt;code&gt;
&lt;?php 
$posts = get_posts(&#039;monthnum=8&amp;orderby=rand&amp;numberposts=3&#039;); foreach($posts as $post) { 
 // ...
}
?&gt;
&lt;/code&gt;&lt;/pre&gt;

Just we added &lt;code&gt;monthnum=8&lt;/code&gt; parameter. This parameter returns posts dated August regardless of the year posted.

If you want to display posts published in July, 2009 randomly, you need to expand your code like this:

&lt;pre&gt;&lt;code&gt;
&lt;?php 
$posts = get_posts(&#039;year=2009&amp;monthnum=7&amp;orderby=rand&amp;numberposts=3&#039;); foreach($posts as $post) { 
 // ...
}
?&gt;
&lt;/code&gt;&lt;/pre&gt;

The above code will return 3 random posts published in July, 2009. 

If you want to make your site more dynamic (e.g. if you want to display random posts from the current month and year), use the code below instead.

&lt;pre&gt;&lt;code&gt;
&lt;?php 
$current_time = getdate();
$posts = get_posts(&#039;year=&#039; .$current_time[&quot;year&quot;] .&#039;&amp;monthnum=&#039; .$current_time[&quot;mon&quot;] . &#039;&amp;orderby=rand&amp;numberposts=3&#039;); foreach($posts as $post) { 
 // ...
}
?&gt;
&lt;/code&gt;&lt;/pre&gt;

The above code displays 3 random posts published in the current month and year (e.g. as the time of writing August, 2009).

Good luck.</description>
		<content:encoded><![CDATA[<p><a href="http://gunnerpress.com/wordpress/wordpress-display-recent-related-or-random-posts-in-your-sidebar/#comment-264" rel="nofollow"><strong><em>Mikel</em></strong></a>, I am very glad that you liked it. <img src='http://gunnerpress.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><a href="http://gunnerpress.com/wordpress/wordpress-display-recent-related-or-random-posts-in-your-sidebar/#comment-273" rel="nofollow"><strong><em>Dave Nalle</em></strong></a>, please double-check your changes. The code published here is the same I used in my current sidebar.</p>
<p><a href="http://gunnerpress.com/wordpress/wordpress-display-recent-related-or-random-posts-in-your-sidebar/#comment-278" rel="nofollow"><strong><em>Minea Adrian</em></strong></a>, let me know what type of <abbr title="Content Management System">CMS</abbr> you are using.</p>
<p><a href="http://gunnerpress.com/wordpress/wordpress-display-recent-related-or-random-posts-in-your-sidebar/#comment-281" rel="nofollow"><strong><em>MK</em></strong></a>, Sure, you can use random posts based on specific month. Replace this line:</p>
<pre><code>
< ?php $posts = get_posts('orderby=rand&#038;numberposts=3'); foreach($posts as $post) {
 // ...
}
?>
</code></pre>
<p>&#8230;with:</p>
<pre><code>
< ?php
$posts = get_posts('monthnum=8&#038;orderby=rand&#038;numberposts=3'); foreach($posts as $post) {
 // ...
}
?>
</code></pre>
<p>Just we added <code>monthnum=8</code> parameter. This parameter returns posts dated August regardless of the year posted.</p>
<p>If you want to display posts published in July, 2009 randomly, you need to expand your code like this:</p>
<pre><code>
< ?php
$posts = get_posts('year=2009&#038;monthnum=7&#038;orderby=rand&#038;numberposts=3'); foreach($posts as $post) {
 // ...
}
?>
</code></pre>
<p>The above code will return 3 random posts published in July, 2009. </p>
<p>If you want to make your site more dynamic (e.g. if you want to display random posts from the current month and year), use the code below instead.</p>
<pre><code>
< ?php
$current_time = getdate();
$posts = get_posts('year=' .$current_time["year"] .'&#038;monthnum=' .$current_time["mon"] . '&#038;orderby=rand&#038;numberposts=3'); foreach($posts as $post) {
 // ...
}
?>
</code></pre>
<p>The above code displays 3 random posts published in the current month and year (e.g. as the time of writing August, 2009).</p>
<p>Good luck.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
