<?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>Gosdot &#187; magpie</title>
	<atom:link href="http://gosdot.com/unity/tag/magpie/feed/" rel="self" type="application/rss+xml" />
	<link>http://gosdot.com/unity</link>
	<description>ux, data, design</description>
	<lastBuildDate>Sat, 22 May 2010 22:17:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>MagpieRSS: Truncating Titles with fetch_rss()</title>
		<link>http://gosdot.com/unity/2008/09/22/magpierss-truncating-titles-with-fetch_rss/</link>
		<comments>http://gosdot.com/unity/2008/09/22/magpierss-truncating-titles-with-fetch_rss/#comments</comments>
		<pubDate>Mon, 22 Sep 2008 06:50:00 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[magpie]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[snoopy]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://gosdot.com/unity/?p=318</guid>
		<description><![CDATA[Truncating RSS titles for the fetch_rss() option of MagpieRSS turned out to be trickier than I initially expected.  If you aren&#8217;t a hardcore php programmer and you&#8217;re just trying to fancy up your Wordpress blog, it can be a little obtuse as to how to achieve this.  After a few Google searches turned [...]]]></description>
			<content:encoded><![CDATA[<p>Truncating RSS titles for the <code>fetch_rss()</code> option of MagpieRSS turned out to be trickier than I initially expected.  If you aren&#8217;t a hardcore php programmer and you&#8217;re just trying to fancy up your Wordpress blog, it can be a little obtuse as to how to achieve this.  After a few Google searches turned up nothing I came up with this solution&#8230;</p>
<pre>
&lt;h3&gt;Title of Your RSS Feed&lt;/h3&gt;
&lt;?php
// assign the feed to a variable named 'feed'
$feed = 'http://url-of-your-rss-feed.com/feed/';
	if ($feed) {
		include_once(ABSPATH . WPINC . '/rss.php');
// define that 'feed' is also your url
$url = $feed;
$rss = fetch_rss($feed);
// string to return if feed fails
 	if ($rss == false){
$string .= "[No Feed To Retrieve]";
	return $string;
}
$maxitems = 10;
$items = array_slice($rss-&gt;items, 0, $maxitems);
	foreach ( $items as $item ) :
// define the string which is '$title'
// define the action 'substr' means sub-string or 'part of a string'
// define where the feed string starts - first letter is '0'
// define the length of the feed string - 55 characters
// define the trailing characters - "..."
$title = substr($item['title'],0,55)." ... ";
?&gt;
&lt;ul&gt;
&lt;li&gt;
// link to the rss item origin with the description as the title
&lt;a href='&lt;?php echo $item['link']; ?&gt;' title='&lt;?php echo $item['description']; ?&gt;'&gt;
// print the truncated RSS title
&lt;?php print $title; ?&gt;
&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;?php endforeach;
}
?&gt;
&lt;br /&gt;&lt;br /&gt;
</pre>
<p>This code will allow you to truncate and print the titles of an rss feed. No more worries about whether or not that aggregated feed from Twitter or another blog will break your design.</p>
]]></content:encoded>
			<wfw:commentRss>http://gosdot.com/unity/2008/09/22/magpierss-truncating-titles-with-fetch_rss/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
