<?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>Lewis Bilsland &#187; php</title>
	<atom:link href="http://www.lewisbilsland.co.uk/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lewisbilsland.co.uk</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sun, 16 May 2010 22:28:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Read more function</title>
		<link>http://www.lewisbilsland.co.uk/wordpress/read-more-function/</link>
		<comments>http://www.lewisbilsland.co.uk/wordpress/read-more-function/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 21:52:47 +0000</pubDate>
		<dc:creator>Lewis</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.lewisbilsland.co.uk/?p=102</guid>
		<description><![CDATA[I decided to place some excerpts on my home page, this helps give users an insight to the blog before clicking through, it&#8217;s something that gives a reader more choice which can&#8217;t be a bad [...]]]></description>
			<content:encoded><![CDATA[<p>I decided to place some excerpts on my home page, this helps give users an insight to the blog before clicking through, it&#8217;s something that gives a reader more choice which can&#8217;t be a bad thing.</p>
<p>To do this you need to insert the following code into your function.php file, there is a part of the code where you can design your own arrow or more link button:</p>
<pre class="php">
add_filter<span class="phpOperator">(</span><span class="phpString">'excerpt_length'</span>, <span class="phpString">'my_excerpt_length'</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpFunctionKeyword">function</span> my_excerpt_length<span class="phpOperator">(</span>$length<span class="phpOperator">)</span> <span class="phpOperator">{</span>
<span class="phpKeyword">
return </span>35<span class="phpText">;</span> <span class="phpOperator">}</span>
<span class="phpComment">//<span class="phpFunctionKeyword">function</span> to replace invalid ellipsis with text
</span><span class="phpFunctionKeyword">function</span> elpie_excerpt<span class="phpOperator">(</span>$text<span class="phpOperator">)</span>
<span class="phpOperator">{</span>
<span class="phpKeyword">
return </span><span class="phpFunction">str_replace</span><span class="phpOperator">(</span><span class="phpString">'<span class="phpOperator">[</span>.<span class="phpOperator">.</span>.<span class="phpOperator">]</span>'</span>, <span class="phpString">'<span class="phpOperator">&lt;</span>a href=<span class="phpString">"'</span>.get_permalink<span class="phpOperator">(</span><span class="phpOperator">)</span>.<span class="phpString">'"&gt;&lt;img src="yourpathhere/readmore.jpg" alt=""</span> /<span class="phpOperator">&gt;</span><span class="phpOperator">&lt;</span>/a<span class="phpOperator">&gt;</span>'</span>, $text<span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpOperator">}</span>
add_filter<span class="phpOperator">(</span><span class="phpString">'the_excerpt'</span>, <span class="phpString">'elpie_excerpt'</span><span class="phpOperator">)</span><span class="phpText">;</span>
</pre>
<p><img class="alignnone size-full wp-image-111" title="spacer" src="http://www.lewisbilsland.co.uk/wp-content/uploads/2010/01/spacer.jpg" alt="" width="647" height="38" /></p>
<p>Now all you need to do is edit your page template to include the following code, you can wrap with a css style to colour the fonts, rollovers etc:</p>
<pre class="php">
<span class="htmlOtherTag">&lt;ul id=<span class="htmlAttributeValue">&quot;recent-items&quot;</span>&gt;</span>
<span class="htmlOtherTag">&lt;ul&gt;</span>
<span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span>
$recentPosts <span class="phpOperator">=</span><span class="phpKeyword"> new </span><span class="htmlText">WP_Query</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpText">;</span>
$recentPosts<span class="phpOperator">-<span class="phpOperator">&gt;</span></span><span class="htmlText">query</span><span class="phpOperator">(</span><span class="phpString">'showposts=<span class="phpNumber">2</span>'</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span>
<span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span><span class="phpKeyword"> while </span><span class="phpOperator">(</span>$recentPosts<span class="phpOperator">-<span class="phpOperator">&gt;</span></span><span class="htmlText">have_posts</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpOperator">)</span> <span class="phpOperator">:</span> $recentPosts<span class="phpOperator">-<span class="phpOperator">&gt;</span></span><span class="htmlText">the_post</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpText">;</span> <span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span>
<span class="htmlOtherTag">&lt;li&gt;</span><span class="htmlAnchorTag">&lt;a href=<span class="htmlAttributeValue">&quot;<span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span><span class="htmlText"> the_permalink</span><span class="phpOperator">(</span><span class="phpOperator">)</span> <span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span>&quot;</span> rel=<span class="htmlAttributeValue">&quot;bookmark&quot;</span>&gt;</span><span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span><span class="htmlText"> the_title</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpText">;</span> <span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span><span class="htmlAnchorTag">&lt;/a&gt;</span><span class="htmlOtherTag">&lt;br /&gt;</span><span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span><span class="htmlText"> the_excerpt</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpText">;</span> <span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span><span class="htmlOtherTag">&lt;/li&gt;</span>
<span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span><span class="phpKeyword"> endwhile<span class="phpText">;</span></span> <span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span>
<span class="htmlOtherTag">&lt;/ul&gt;</span>
<span class="htmlOtherTag">&lt;/ul&gt;</span>
</pre>
<p><img class="alignnone size-full wp-image-111" title="spacer" src="http://www.lewisbilsland.co.uk/wp-content/uploads/2010/01/spacer.jpg" alt="" width="647" height="38" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lewisbilsland.co.uk/wordpress/read-more-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
