<?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>CKnol.Com &#187; Wordpress</title>
	<atom:link href="http://www.cknol.com/category/wordpress/feed" rel="self" type="application/rss+xml" />
	<link>http://www.cknol.com</link>
	<description>The Center of Knowledges</description>
	<lastBuildDate>Sun, 14 Dec 2008 18:09:00 +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>How to Modifying WordPress Related Post Plugins</title>
		<link>http://www.cknol.com/wordpress/how-to-modifying-wordpress-related-post-plugins.html</link>
		<comments>http://www.cknol.com/wordpress/how-to-modifying-wordpress-related-post-plugins.html#comments</comments>
		<pubDate>Fri, 14 Dec 2007 18:41:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Plugins]]></category>

	<!-- AutoMeta Start -->
	<category>download</category>
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://www.cknol.com/?p=5</guid>
		<description><![CDATA[First, if you do not have Related Post plugins, you can download it from the author&#8217;s website (Link). This little modification will make your Related Post plugin more powerful and useful. Follow these steps to update the plugin: Copy these code: &#60;? if (! function_exists(”related_posts”)) { function related_posts($limit=5, $len=10, $before_title = ”, $after_title = ”, [...]]]></description>
			<content:encoded><![CDATA[<p>First, if you do not have Related Post plugins, you can download it from the author&#8217;s website (<a title="Related Post Plugins" href="http://www.w-a-s-a-b-i.com/archives/2004/05/26/wordpress-related-entries-plugin/" target="_blank">Link</a>). This little modification will make your Related  Post plugin more powerful and useful.</p>
<p><span id="more-5"></span></p>
<p>Follow these steps to update the plugin:</p>
<ol>
<li>Copy these code:</li>
<p><code>&lt;? if (! function_exists(”related_posts”))<br />
{</code></p>
<p><code>function related_posts($limit=5, $len=10, $before_title = ”, $after_title = ”, $before_post = ”, $after_post = ”, $show_pass_post = false, $show_excerpt = false, $before_last_title = ”, $after_last_title = ”) {</code></p>
<p><code>global $wpdb, $post, $tableposts;</code></p>
<p><code>if ($before_last_title == ”) {<br />
$before_last_title = $before_title;<br />
}<br />
if ($after_last_title = ”) {<br />
$after_last_title = $after_title;<br />
}</code></p>
<p><code>$postcustom = get_post_custom_values(’keyword’);<br />
if (!empty($postcustom)) {<br />
$values = array_map(’trim’, $postcustom);<br />
$terms = implode($values, ‘ ‘);<br />
} else {<br />
$terms = str_replace(’-', ‘ ‘, $post-&gt;post_name);<br />
}</code></p>
<p><code>$time_difference = get_settings(’gmt_offset’);<br />
$now = gmdate(”Y-m-d H:i:s”,(time()+($time_difference*3600)));</code></p>
<p><code>$sql = “SELECT ID, post_title, post_content,”<br />
. “MATCH (post_name, post_content) ”<br />
. “AGAINST (’$terms’) AS score ”<br />
. “FROM $tableposts WHERE ”<br />
. “MATCH (post_name, post_content) ”<br />
. “AGAINST (’$terms’) ”<br />
. “AND post_date &lt; = '$now' "<br />
. "AND (post_status = 'publish' &amp;&amp; ID != '$post-&gt;ID’) “;<br />
if (!$show_pass_post) { $sql .= “AND post_password =” “; }<br />
$sql .= “ORDER BY score DESC LIMIT $limit”;<br />
$results = $wpdb-&gt;get_results($sql);<br />
$output = ”;<br />
if ($results) {<br />
$index = 1;<br />
foreach ($results as $result) {<br />
$title = stripslashes(apply_filters(’the_title’, $result-&gt;post_title));<br />
$permalink = get_permalink($result-&gt;ID);<br />
$post_content = strip_tags($result-&gt;post_content);</code></p>
<p><code>$post_content = stripslashes($post_content);<br />
if (($limit&gt;1) &amp;&amp; ($index==$limit)) {<br />
$output .= $before_last_title .’‘ . $title . ‘‘ . $after_last_title;<br />
} else {<br />
$output .= $before_title .’‘ . $title . ‘‘ . $after_title;<br />
}<br />
if ($show_excerpt) {<br />
$words=split(” “,$post_content);<br />
$post_strip = join(” “, array_slice($words,0,$len));<br />
$output .= $before_post . $post_strip . $after_post;<br />
}<br />
$index++;<br />
}<br />
echo $output;<br />
} else {<br />
echo $before_title.’No related posts’.$after_title;<br />
}<br />
}</code></p>
<p><code>// End of related_posts<br />
?&gt;</code></p>
<li>Go to line 52. It should read:<br />
<code>if (!  function_exists("related_posts"))</code></li>
<li>Scroll down a little bit and find line contains:<br />
<code>// End of  related_posts<br />
</code>It should be on around line 110.</li>
<li>Now remove line 52 until above line, and replace it with the new code you have  copied from the point number one. Save your works.</li>
<li>The new related_post function will now have 2 extra parameter,  <strong>$before_last_title</strong> and <strong>$after_last_title</strong>.  Modify your theme to match the new function.<br />
Mine is:<br />
<code>Related Post: &lt;  ?php related_posts(5, 10, '', ', ', '', '', false, false,' and ','.');  ?&gt;</code></li>
</ol>
<p>Good luck!</p>
<img src="http://www.cknol.com/?ak_action=api_record_view&id=5&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.cknol.com/wordpress/how-to-modifying-wordpress-related-post-plugins.html/feed</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>
