<?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>WpFunc &#187; Related posts</title>
	<atom:link href="http://wpfunc.com/tag/related-posts/feed" rel="self" type="application/rss+xml" />
	<link>http://wpfunc.com</link>
	<description>Awesome, Quick, Simple WordPress Functions!</description>
	<lastBuildDate>Sun, 06 May 2012 02:21:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Related Posts With Thumbnails</title>
		<link>http://wpfunc.com/wordpress/related-posts-with-thumbnails.html</link>
		<comments>http://wpfunc.com/wordpress/related-posts-with-thumbnails.html#comments</comments>
		<pubDate>Sun, 14 Feb 2010 16:51:20 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[content]]></category>
		<category><![CDATA[posts]]></category>
		<category><![CDATA[Related posts]]></category>
		<category><![CDATA[tim thumb]]></category>

		<guid isPermaLink="false">http://www.wpfunc.com/?p=396</guid>
		<description><![CDATA[We can add our related posts with thumnails after our content. There is a lot of plugin for that but we can do this without any plugin. But we need Tim Tumb for thumbnails. Let&#8217;s begin&#8230; Here is The Code; Add this code after content. Look at Tim Thumb at here. Have a nice day!]]></description>
			<content:encoded><![CDATA[<p>We can add our related posts with thumnails after our content. There is a lot of plugin for that but we can do this without any plugin. But we need Tim Tumb for thumbnails. Let&#8217;s begin&#8230;<span id="more-396"></span></p>
<h3>Here is The Code;</h3>
<pre class="brush: php; title: ; notranslate">&lt;?php
$original_post = $post;
$tags = wp_get_post_tags($post-&gt;ID);
if ($tags) {
  echo '&lt;h2&gt;Related Posts&lt;/h2&gt;';
  $first_tag = $tags[0]-&gt;term_id;
  $args=array(
    'tag__in' =&gt; array($first_tag),
    'post__not_in' =&gt; array($post-&gt;ID),
    'showposts'=&gt;4,
    'caller_get_posts'=&gt;1
   );
  $my_query = new WP_Query($args);
  if( $my_query-&gt;have_posts() ) {
    echo &quot;&lt;ul&gt;&quot;;
    while ($my_query-&gt;have_posts()) : $my_query-&gt;the_post(); ?&gt;
      &lt;li&gt;&lt;img src=&quot;&lt;?php bloginfo('template_directory'); ?&gt;/timthumb/timthumb.php?src=&lt;?php echo get_post_meta($post-&gt;ID, &quot;post-img&quot;, true); ?&gt;&amp;h=40&amp;w=40&amp;zc=1&quot; alt=&quot;&quot; /&gt;&lt;a href=&quot;&lt;?php the_permalink() ?&gt;&quot; rel=&quot;bookmark&quot; title=&quot;Permanent Link to &lt;?php the_title_attribute(); ?&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/li&gt;
    &lt;?php endwhile;
    echo &quot;&lt;/ul&gt;&quot;;
  }
}
$post = $original_post;
wp_reset_query();
?&gt;</pre>
<p>Add this code after <strong>content</strong>. Look at <a href="http://www.darrenhoyt.com/2008/04/02/timthumb-php-script-released/" target="_blank">Tim Thumb</a> at here. Have a nice day!</p>
]]></content:encoded>
			<wfw:commentRss>http://wpfunc.com/wordpress/related-posts-with-thumbnails.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Related Posts, Without any Plugin!</title>
		<link>http://wpfunc.com/general/related-posts-without-any-plugin.html</link>
		<comments>http://wpfunc.com/general/related-posts-without-any-plugin.html#comments</comments>
		<pubDate>Mon, 20 Jul 2009 08:00:47 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[recipe]]></category>
		<category><![CDATA[Related posts]]></category>
		<category><![CDATA[without plugin]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.wpfunc.com/?p=81</guid>
		<description><![CDATA[Hi everybody. You can show your related posts without any plugin. It&#8217;is important for visitors i think. Because they can discover your blog with that area. This code shows your same-tagged posts. Some plugins do this but why use plugin if you have a powerfull theme :). You can change posts number too. Lets Begin&#8230; [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Hi everybody. You can show your related posts without any plugin. It&#8217;is important for visitors i think. Because they can discover your blog with that area. This code shows your same-tagged posts. Some plugins do this but why use plugin if you have a powerfull theme :). You can change posts number too. Lets Begin&#8230;<span id="more-81"></span></p>
<p style="text-align: justify;"><span class="attention"><strong>With this function/recipe you will change your core single.php file. If you have no information about WordPress coding -so you&#8217;re a newbie- you can get some support if you send a mail to me. Don&#8217;t touch your single.php if you don&#8217;t know about WordPress</strong></span></p>
<p style="text-align: justify;">We will change our themes <strong><em>single.php</em></strong>. Make bakcup and be careful. After backup open <strong>single.php</strong> and copy this code after loop or content.</p>
<h3>Here is the code;</h3>
<pre class="brush: plain; title: ; notranslate">&lt;?php
      //for use in the loop, list 5 post titles related to first tag on current post
      $tags = wp_get_post_tags($post-&gt;ID);
if ($tags) {
echo 'Related Posts';
$first_tag = $tags[0]-&gt;term_id;
$args=array(
'tag__in' =&gt; array($first_tag),
'post__not_in' =&gt; array($post-&gt;ID),
'showposts'=&gt;5,
'caller_get_posts'=&gt;1
);
$my_query = new WP_Query($args);
if( $my_query-&gt;have_posts() ) {
while ($my_query-&gt;have_posts()) : $my_query-&gt;the_post(); ?&gt;
     &lt;p&gt;&lt;a href=&quot;&lt;?php the_permalink() ?&gt;&quot; rel=&quot;bookmark&quot; title=&quot;Permanent Link to &lt;?php the_title_attribute(); ?&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/p&gt;
    &lt;?php
  endwhile;
  }
 }
?&gt; </pre>
<p>Save single.php. And then refresh your page. Related Posts are display after content. :) If you change &#8216;<em><strong>showpost=5</strong></em>&#8216; (<em><strong>the 5 is post number</strong></em>) 5 to 4,6,9,etc. Related posts number will change.</p>
<p>That&#8217;s All! Have a nice day!</p>
]]></content:encoded>
			<wfw:commentRss>http://wpfunc.com/general/related-posts-without-any-plugin.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

