<?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: Manage Multiple Excerpt Lengths</title>
	<atom:link href="http://wpengineer.com/1909/manage-multiple-excerpt-lengths/feed/" rel="self" type="application/rss+xml" />
	<link>http://wpengineer.com/1909/manage-multiple-excerpt-lengths/</link>
	<description>WordPress News, Hacks, Tips, Tutorials, Plugins and Themes</description>
	<lastBuildDate>Wed, 08 Feb 2012 19:48:58 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Imad</title>
		<link>http://wpengineer.com/1909/manage-multiple-excerpt-lengths/#comment-8281</link>
		<dc:creator>Imad</dc:creator>
		<pubDate>Sun, 24 Apr 2011 13:37:23 +0000</pubDate>
		<guid isPermaLink="false">http://wpengineer.com/?p=1909#comment-8281</guid>
		<description>Great piece of code, i noticed lots of changes with time passing and wp versions, if someone could make a plugin from that it would be better for updates and maintenance than updating the code each time, i mean for simple wp users like me, but anyway i got what i needed why am i asking for more...Big Thanks</description>
		<content:encoded><![CDATA[<p>Great piece of code, i noticed lots of changes with time passing and wp versions, if someone could make a plugin from that it would be better for updates and maintenance than updating the code each time, i mean for simple wp users like me, but anyway i got what i needed why am i asking for more...Big Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul</title>
		<link>http://wpengineer.com/1909/manage-multiple-excerpt-lengths/#comment-8124</link>
		<dc:creator>Paul</dc:creator>
		<pubDate>Sun, 10 Apr 2011 13:25:00 +0000</pubDate>
		<guid isPermaLink="false">http://wpengineer.com/?p=1909#comment-8124</guid>
		<description>Apologies for the multiple comments .... just spotted another bit worth tweaking .... 

This final code works perfectly in WP 3.1.1 .... Thanks again to all here who know waaay more than I do!!!

&lt;code&gt;
function my_excerpt($excerpt = &#039;&#039;, $excerpt_length = 50, $readmore = &quot;Read more &#187;&quot;, $tags = &#039;&lt;a&gt;&#039;) {
	global $post;
	$string_check = explode(&#039; &#039;, $excerpt);
	if (count($string_check, COUNT_RECURSIVE) &gt; $excerpt_length) {
		$new_excerpt_words = explode(&#039; &#039;, $excerpt, $excerpt_length+1);
		array_pop($new_excerpt_words);
		$excerpt_text = implode(&#039; &#039;, $new_excerpt_words);
		$temp_content = strip_tags($excerpt_text, $tags);
		$short_content = preg_replace(&#039;`\[[^\]]*\]`&#039;,&#039;&#039;,$temp_content);
		$short_content .= &#039; ... &lt;a href=&quot;&#039; . get_permalink() . &#039;&quot; rel=&quot;nofollow&quot;&gt;&#039;. $readmore . &#039;&lt;/a&gt;&#039;;
		return $short_content;
	} else {
		return $excerpt;
	}
}
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Apologies for the multiple comments .... just spotted another bit worth tweaking .... </p>
<p>This final code works perfectly in WP 3.1.1 .... Thanks again to all here who know waaay more than I do!!!</p>
<p><code><br />
function my_excerpt($excerpt = '', $excerpt_length = 50, $readmore = "Read more &raquo;", $tags = '<a>') {<br />
	global $post;<br />
	$string_check = explode(' ', $excerpt);<br />
	if (count($string_check, COUNT_RECURSIVE) &gt; $excerpt_length) {<br />
		$new_excerpt_words = explode(' ', $excerpt, $excerpt_length+1);<br />
		array_pop($new_excerpt_words);<br />
		$excerpt_text = implode(' ', $new_excerpt_words);<br />
		$temp_content = strip_tags($excerpt_text, $tags);<br />
		$short_content = preg_replace('`\[[^\]]*\]`','',$temp_content);<br />
		$short_content .= ' ... </a><a href="' . get_permalink() . '" rel="nofollow">'. $readmore . '</a>';<br />
		return $short_content;<br />
	} else {<br />
		return $excerpt;<br />
	}<br />
}<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul</title>
		<link>http://wpengineer.com/1909/manage-multiple-excerpt-lengths/#comment-8122</link>
		<dc:creator>Paul</dc:creator>
		<pubDate>Sun, 10 Apr 2011 12:34:08 +0000</pubDate>
		<guid isPermaLink="false">http://wpengineer.com/?p=1909#comment-8122</guid>
		<description>Hhhmmm .... kinda .... 

you&#039;ll need to replace the special character for &quot;read more&quot; with &amp;-r-a-q-u-o; (delete all dashes) and make sure the &quot;greater than&quot; after COUNT_RECURSIVE is correct....

Anyway... MIchael .... Many thanks for the post....

Any chance you could put an indicator beside the comments box for hoe yo paste code.... :-)

:-p</description>
		<content:encoded><![CDATA[<p>Hhhmmm .... kinda .... </p>
<p>you'll need to replace the special character for "read more" with &amp;-r-a-q-u-o; (delete all dashes) and make sure the "greater than" after COUNT_RECURSIVE is correct....</p>
<p>Anyway... MIchael .... Many thanks for the post....</p>
<p>Any chance you could put an indicator beside the comments box for hoe yo paste code.... <img src='http://wpengineer.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>:-p</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul</title>
		<link>http://wpengineer.com/1909/manage-multiple-excerpt-lengths/#comment-8121</link>
		<dc:creator>Paul</dc:creator>
		<pubDate>Sun, 10 Apr 2011 12:25:56 +0000</pubDate>
		<guid isPermaLink="false">http://wpengineer.com/?p=1909#comment-8121</guid>
		<description>@ Tompa and Paul

Many thanks ... works prefectly ... except for a couple of little errors in Tompa&#039;s code... (one due to the pasting of code) ... not sure how to paste in code here myself tho.... but here goes.....

&lt;code&gt;
function my_excerpt($excerpt = &#039;&#039;, $excerpt_length = 50, $readmore = &quot;Read more &#187;&quot;, $tags = &#039;&lt;a&gt;&#039;) {
	global $post;
	$string_check = explode(&#039; &#039;, $excerpt);
&lt;/code&gt;&lt;code&gt;
	if (count($string_check, COUNT_RECURSIVE) &gt; $excerpt_length) {
		$new_excerpt_words = explode(&#039; &#039;, $excerpt, $excerpt_length+1);
		array_pop($new_excerpt_words);
		$excerpt_text = implode(&#039; &#039;, $new_excerpt_words);
		$temp_content = strip_tags($excerpt_text, $tags);
		$short_content = preg_replace(&#039;`\[[^\]]*\]`&#039;,&#039;&#039;,$temp_content);
		$short_content .= &#039; ... &lt;a href=&quot;&#039; . get_permalink() . &#039;&quot; rel=&quot;nofollow&quot;&gt;&#039; .post_title . &#039;&quot;&#187;&#039; . $readmore . &#039;&lt;/a&gt;&#039;;
		return $short_content;
	} else {
		return $excerpt;
	}
}
&lt;/code&gt;

then in your template

&lt;code&gt;

&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>@ Tompa and Paul</p>
<p>Many thanks ... works prefectly ... except for a couple of little errors in Tompa's code... (one due to the pasting of code) ... not sure how to paste in code here myself tho.... but here goes.....</p>
<p><code><br />
function my_excerpt($excerpt = '', $excerpt_length = 50, $readmore = "Read more &raquo;", $tags = '<a>') {<br />
	global $post;<br />
	$string_check = explode(' ', $excerpt);<br />
</a></code><code><br />
	if (count($string_check, COUNT_RECURSIVE) &gt; $excerpt_length) {<br />
		$new_excerpt_words = explode(' ', $excerpt, $excerpt_length+1);<br />
		array_pop($new_excerpt_words);<br />
		$excerpt_text = implode(' ', $new_excerpt_words);<br />
		$temp_content = strip_tags($excerpt_text, $tags);<br />
		$short_content = preg_replace('`\[[^\]]*\]`','',$temp_content);<br />
		$short_content .= ' ... <a href="' . get_permalink() . '" rel="nofollow">' .post_title . '"&raquo;' . $readmore . '</a>';<br />
		return $short_content;<br />
	} else {<br />
		return $excerpt;<br />
	}<br />
}<br />
</code></p>
<p>then in your template</p>
<p><code></code></p>
<p></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Ahrens</title>
		<link>http://wpengineer.com/1909/manage-multiple-excerpt-lengths/#comment-6452</link>
		<dc:creator>Peter Ahrens</dc:creator>
		<pubDate>Wed, 02 Feb 2011 03:59:18 +0000</pubDate>
		<guid isPermaLink="false">http://wpengineer.com/?p=1909#comment-6452</guid>
		<description>Thanks for that, it&#039;s exactly what I needed. My homepage recent posts have only 15 words, my blog uses full posts and the archive uses 50 words. I thought it was going to be hard to do that, proves not the be the case at all.</description>
		<content:encoded><![CDATA[<p>Thanks for that, it's exactly what I needed. My homepage recent posts have only 15 words, my blog uses full posts and the archive uses 50 words. I thought it was going to be hard to do that, proves not the be the case at all.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tompa</title>
		<link>http://wpengineer.com/1909/manage-multiple-excerpt-lengths/#comment-6420</link>
		<dc:creator>Tompa</dc:creator>
		<pubDate>Thu, 27 Jan 2011 11:58:06 +0000</pubDate>
		<guid isPermaLink="false">http://wpengineer.com/?p=1909#comment-6420</guid>
		<description>First of all: Thanks for this piece of code, and speciall thanks to Paul who wrote a piece that was better suited for my purpose! However, it woulden´t work in WP 3 because of the change to GUID in WP 2.5. ( &lt;a href=&quot;http://codex.wordpress.org/Function_Reference/get_post&quot; rel=&quot;nofollow&quot;&gt;http://codex.wordpress.org/Function_Reference/get_post&lt;/a&gt; )

So I changed it a little bit;
&lt;code&gt;
function my_excerpt($excerpt = &#039;&#039;, $excerpt_length = 50, $readmore = &quot;Read more &#194;&#187;&quot;, $tags = &#039;&lt;a&gt;&#039;) {
global $post;
$string_check = explode(&#039; &#039;, $excerpt);
 
if (count($string_check, COUNT_RECURSIVE) &gt; $excerpt_length) {
	$new_excerpt_words = explode(&#039; &#039;, $excerpt, $excerpt_length+1);
	array_pop($new_excerpt_words);
	$excerpt_text = implode(&#039; &#039;, $new_excerpt_words);
	$temp_content = strip_tags($excerpt_text, $tags);
	$short_content = preg_replace(&#039;`\[[^\]]*\]`&#039;,&#039;&#039;,$temp_content);
	$short_content .= &#039; ... &lt;a href=&quot;&#039; .  get_permalink() . &#039;&quot; rel=&quot;nofollow&quot;&gt;post_title . &#039;&quot;&gt;&#039; . $readmore . &#039;&lt;/a&gt;&#039;;
	return $short_content;
	} else {
	return $excerpt;
	}
}
&lt;/code&gt;

Works for me, hope it will for you to! :)

Oh, added support for shorter posts as well.</description>
		<content:encoded><![CDATA[<p>First of all: Thanks for this piece of code, and speciall thanks to Paul who wrote a piece that was better suited for my purpose! However, it woulden´t work in WP 3 because of the change to GUID in WP 2.5. ( <a href="http://codex.wordpress.org/Function_Reference/get_post" rel="nofollow">http://codex.wordpress.org/Function_Reference/get_post</a> )</p>
<p>So I changed it a little bit;<br />
<code><br />
function my_excerpt($excerpt = '', $excerpt_length = 50, $readmore = &quot;Read more &Acirc;&raquo;&quot;, $tags = '&lt;a&gt;') {<br />
global $post;<br />
$string_check = explode(' ', $excerpt);</code></p>
<p>if (count($string_check, COUNT_RECURSIVE) &amp;gt; $excerpt_length) {<br />
	$new_excerpt_words = explode(' ', $excerpt, $excerpt_length+1);<br />
	array_pop($new_excerpt_words);<br />
	$excerpt_text = implode(' ', $new_excerpt_words);<br />
	$temp_content = strip_tags($excerpt_text, $tags);<br />
	$short_content = preg_replace('`\[[^\]]*\]`','',$temp_content);<br />
	$short_content .= ' ... &lt;a href=&quot;' .  get_permalink() . '&quot; rel=&quot;nofollow&quot;&gt;post_title . '&quot;&amp;gt;' . $readmore . '&lt;/a&gt;';<br />
	return $short_content;<br />
	} else {<br />
	return $excerpt;<br />
	}<br />
}<br />
</p>
<p>Works for me, hope it will for you to! <img src='http://wpengineer.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Oh, added support for shorter posts as well.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://wpengineer.com/1909/manage-multiple-excerpt-lengths/#comment-6284</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Fri, 07 Jan 2011 20:44:28 +0000</pubDate>
		<guid isPermaLink="false">http://wpengineer.com/?p=1909#comment-6284</guid>
		<description>You can modify the function with
&lt;code&gt;return &#039; &hellip; &lt;a href=&quot;&#039;. get_permalink() . &#039;&quot; rel=&quot;nofollow&quot;&gt;Continue reading &rarr;&lt;/a&gt;&#039;;&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>You can modify the function with<br />
<code>return ' &amp;hellip; &lt;a href=&quot;'. get_permalink() . '&quot; rel=&quot;nofollow&quot;&gt;Continue reading &amp;rarr;&lt;/a&gt;';</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://wpengineer.com/1909/manage-multiple-excerpt-lengths/#comment-6283</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Fri, 07 Jan 2011 20:18:25 +0000</pubDate>
		<guid isPermaLink="false">http://wpengineer.com/?p=1909#comment-6283</guid>
		<description>I have this working, except for the more string? It&#039;s not a link, it&#039;s just a string. I tried adding the_permalink() to it, but it didn&#039;t like it.

Does this not return more string as a link?</description>
		<content:encoded><![CDATA[<p>I have this working, except for the more string? It's not a link, it's just a string. I tried adding the_permalink() to it, but it didn't like it.</p>
<p>Does this not return more string as a link?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: WPEngineer gears up for their own WordPress Advent Calendar &#124; WPCandy</title>
		<link>http://wpengineer.com/1909/manage-multiple-excerpt-lengths/#comment-5281</link>
		<dc:creator>WPEngineer gears up for their own WordPress Advent Calendar &#124; WPCandy</dc:creator>
		<pubDate>Tue, 30 Nov 2010 21:21:52 +0000</pubDate>
		<guid isPermaLink="false">http://wpengineer.com/?p=1909#comment-5281</guid>
		<description>[...] an interesting discussion on working with WP 2.9 post thumbnails, to extending user info, managing multiple excerpt lengths, and [...]</description>
		<content:encoded><![CDATA[<p>[...] an interesting discussion on working with WP 2.9 post thumbnails, to extending user info, managing multiple excerpt lengths, and [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Keri</title>
		<link>http://wpengineer.com/1909/manage-multiple-excerpt-lengths/#comment-5100</link>
		<dc:creator>Keri</dc:creator>
		<pubDate>Sun, 31 Oct 2010 22:38:53 +0000</pubDate>
		<guid isPermaLink="false">http://wpengineer.com/?p=1909#comment-5100</guid>
		<description>Yay! Works perfectly. Thanks so much! =)</description>
		<content:encoded><![CDATA[<p>Yay! Works perfectly. Thanks so much! =)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

