<?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>I am Ad Taylor &#187; wordpress</title>
	<atom:link href="http://www.iamadtaylor.com/tag/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.iamadtaylor.com</link>
	<description>The portfolio and blog of Ad Taylor</description>
	<lastBuildDate>Thu, 20 May 2010 22:49:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Removing p tags from the_excerpt</title>
		<link>http://www.iamadtaylor.com/removing-p-tags-from-the_excerpt/</link>
		<comments>http://www.iamadtaylor.com/removing-p-tags-from-the_excerpt/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 09:17:31 +0000</pubDate>
		<dc:creator>Ad Taylor</dc:creator>
				<category><![CDATA[shorts]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.iamadtaylor.com/?p=43</guid>
		<description><![CDATA[Deleting the p tags from the expert — the slightly extreme way.]]></description>
			<content:encoded><![CDATA[<p>Making this blog I found many silly little stumbling blocks that slowed me down. Don&#8217;t get me wrong I think Wordpress is great but some of the formatting is simply awful.</p>
<p>A great example of this is the_excerpt call;<br />
There is a pretty good chance your going to want to link the text to post and if you care about semantics mark it up with hfeed and rel=&#8221;bookmark&#8221;. Well good luck if you want a strict valid page as it comes free wrapped in <code>p</code> tags.</p>
<p><strong>RANT OVER.</strong><br />
The fix: (Warning &#8211; this is a fix that goes straight for Wordpress core files)</p>
<ol>
<li>Open up wp-includes>formatting.php</li>
<li>go to line 1498 (the function is called <code>function wp_trim_excerpt($text)</code>)</li>
<li>and add the line :
<pre><code>// Removes the p from excerpts
remove_filter('the_excerpt', 'wpautop');</code></pre>
</li>
</ol>
<p>My function now looks like this:</p>
<pre>
<code>function wp_trim_excerpt($text) {
	if ( '' == $text ) {
		$text = get_the_content('');

		$text = strip_shortcodes( $text );

		$text = apply_filters('the_content', $text);
		$text = str_replace(']]&gt;', ']]&gt;', $text);
		$text = strip_tags($text);
		$excerpt_length = apply_filters('excerpt_length', 55);
		$words = explode(' ', $text, $excerpt_length + 1);
		if (count($words) > $excerpt_length) {
			array_pop($words);
			array_push($words, '[...]');
			$text = implode(' ', $words);
		}

		// Removes the p from excerpts
		remove_filter('the_excerpt', 'wpautop');

	}
	return $text;
}</code></pre>
</p>
<p>I&#8217;m not saying this is the correct way — I am by now means a developer — but it works.</p>
<p><strong>EDIT : <em>Since installing 2.8 I realised this was a bad idea as the modifications made were written over. I made a plugin to perform the action instead but I shall cover this in a post very soon.</em></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.iamadtaylor.com/removing-p-tags-from-the_excerpt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

