<?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 Hacks: Change How Functions Act</title>
	<atom:link href="http://impnerd.com/web-development/wordpress-hacks-change-how-functions-act/feed" rel="self" type="application/rss+xml" />
	<link>http://impnerd.com/web-development/wordpress-hacks-change-how-functions-act</link>
	<description>Internet - Marketing - Publishing</description>
	<lastBuildDate>Wed, 30 Sep 2009 16:57:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Gary R. Hess</title>
		<link>http://impnerd.com/web-development/wordpress-hacks-change-how-functions-act#comment-15712</link>
		<dc:creator>Gary R. Hess</dc:creator>
		<pubDate>Mon, 10 Nov 2008 23:08:07 +0000</pubDate>
		<guid isPermaLink="false">http://impnerd.com/?p=815#comment-15712</guid>
		<description>@Sam you&#039;re right, for whatever reason it doesn&#039;t work for the newest WordPress version. I&#039;ll try to hunt it down.</description>
		<content:encoded><![CDATA[<p>@Sam you&#8217;re right, for whatever reason it doesn&#8217;t work for the newest WordPress version. I&#8217;ll try to hunt it down.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam</title>
		<link>http://impnerd.com/web-development/wordpress-hacks-change-how-functions-act#comment-15703</link>
		<dc:creator>Sam</dc:creator>
		<pubDate>Mon, 10 Nov 2008 19:50:52 +0000</pubDate>
		<guid isPermaLink="false">http://impnerd.com/?p=815#comment-15703</guid>
		<description>Gary, 

Thanks for responding so quickly. I&#039;ve been trying this for a day and lost a couple of patches of hair in the process.

I changed the quote marks and placed the copy and pasted code in my functions folder. Here&#039;s what it currently looks like:

function homepage_excerpt($text = &#039; &#039;) { // Fakes an excerpt if needed
if ( &#039;&#039; == $text ) {
$text = get_the_content(&#039;&#039;);
$text = strip_shortcodes( $text );
$text = apply_filters(&#039;the_content&#039;, $text);
$text = preg_replace(&#039;@.*?@si&#039;, &#039;&#039;, $text); //remove javascript
$text = preg_replace(&#039;@@&#039;, &#039; &#039;, $text); // remove CDATA, html comments
$text = str_replace(&#039;]]&gt;&#039;, &#039;]]&gt;&#039;, $text);
$text = strip_tags($text, &#039; &#039;);
$excerpt_length = 25;
$words = explode(&#039; &#039;, $text, $excerpt_length + 1);
array_pop($words);
array_push($words, &#039;[...]&#039;);
$text = implode(&#039; &#039;, $words);
}
return $text;
}

remove_filter(&#039;get_the_excerpt&#039;, &#039;wp_trim_excerpt&#039;);
add_filter(&#039;get_the_excerpt&#039;, &#039;homepage_excerpt&#039;);

Basically I am trying to get different excerpt functions working so I can call excerpts of different lengths onto different pages.

 (I&#039;m building a magazine CMS version of wordpress and your code seemed the cleanest)

I keep getting this error though:

Warning: Missing argument 1 for homepage_excerpt(), called in /home/site/public_html/testblog/wp-content/themes/pdmag1108/home.php on line 54 and defined in /home/site/public_html/testblog/wp-content/themes/pdmag1108/functions.php on line 565</description>
		<content:encoded><![CDATA[<p>Gary, </p>
<p>Thanks for responding so quickly. I&#8217;ve been trying this for a day and lost a couple of patches of hair in the process.</p>
<p>I changed the quote marks and placed the copy and pasted code in my functions folder. Here&#8217;s what it currently looks like:</p>
<p>function homepage_excerpt($text = &#8216; &#8216;) { // Fakes an excerpt if needed<br />
if ( &#8221; == $text ) {<br />
$text = get_the_content(&#8221;);<br />
$text = strip_shortcodes( $text );<br />
$text = apply_filters(&#8216;the_content&#8217;, $text);<br />
$text = preg_replace(&#8216;@.*?@si&#8217;, &#8221;, $text); //remove javascript<br />
$text = preg_replace(&#8216;@@&#8217;, &#8216; &#8216;, $text); // remove CDATA, html comments<br />
$text = str_replace(&#8216;]]&gt;&#8217;, &#8216;]]&gt;&#8217;, $text);<br />
$text = strip_tags($text, &#8216; &#8216;);<br />
$excerpt_length = 25;<br />
$words = explode(&#8216; &#8216;, $text, $excerpt_length + 1);<br />
array_pop($words);<br />
array_push($words, &#8216;[...]&#8216;);<br />
$text = implode(&#8216; &#8216;, $words);<br />
}<br />
return $text;<br />
}</p>
<p>remove_filter(&#8216;get_the_excerpt&#8217;, &#8216;wp_trim_excerpt&#8217;);<br />
add_filter(&#8216;get_the_excerpt&#8217;, &#8216;homepage_excerpt&#8217;);</p>
<p>Basically I am trying to get different excerpt functions working so I can call excerpts of different lengths onto different pages.</p>
<p> (I&#8217;m building a magazine CMS version of wordpress and your code seemed the cleanest)</p>
<p>I keep getting this error though:</p>
<p>Warning: Missing argument 1 for homepage_excerpt(), called in /home/site/public_html/testblog/wp-content/themes/pdmag1108/home.php on line 54 and defined in /home/site/public_html/testblog/wp-content/themes/pdmag1108/functions.php on line 565</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gary R. Hess</title>
		<link>http://impnerd.com/web-development/wordpress-hacks-change-how-functions-act#comment-15701</link>
		<dc:creator>Gary R. Hess</dc:creator>
		<pubDate>Mon, 10 Nov 2008 19:30:14 +0000</pubDate>
		<guid isPermaLink="false">http://impnerd.com/?p=815#comment-15701</guid>
		<description>@Sam you need to give a lot more information than that :)

Did you just copy and past the function? (If so, you need to change the quote marks to single quotes, wordpress prints them weird). If you did, then your text variable isn&#039;t set for some reason. You can try changing it to $text = &#039;&#039; within the function:

function themename_trim_excerpt($text = &#039;&#039;)</description>
		<content:encoded><![CDATA[<p>@Sam you need to give a lot more information than that <img src='http://impnerd.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Did you just copy and past the function? (If so, you need to change the quote marks to single quotes, wordpress prints them weird). If you did, then your text variable isn&#8217;t set for some reason. You can try changing it to $text = &#39;&#39; within the function:</p>
<p>function themename_trim_excerpt($text = &#39;&#39;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam</title>
		<link>http://impnerd.com/web-development/wordpress-hacks-change-how-functions-act#comment-15700</link>
		<dc:creator>Sam</dc:creator>
		<pubDate>Mon, 10 Nov 2008 18:28:39 +0000</pubDate>
		<guid isPermaLink="false">http://impnerd.com/?p=815#comment-15700</guid>
		<description>Hi, I tried this and got this error: 

Warning: Missing argument 1. Any idea why?</description>
		<content:encoded><![CDATA[<p>Hi, I tried this and got this error: </p>
<p>Warning: Missing argument 1. Any idea why?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
