<?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: Better WordPress pagination</title>
	<atom:link href="http://sltaylor.co.uk/blog/better-wordpress-pagination/feed/" rel="self" type="application/rss+xml" />
	<link>http://sltaylor.co.uk/blog/better-wordpress-pagination/</link>
	<description>Freelance WordPress developer in London - XHTML, CSS &#38; design</description>
	<lastBuildDate>Tue, 09 Mar 2010 23:56:20 +0000</lastBuildDate>
	
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Steven Wilson</title>
		<link>http://sltaylor.co.uk/blog/better-wordpress-pagination/#comment-4594</link>
		<dc:creator>Steven Wilson</dc:creator>
		<pubDate>Thu, 04 Mar 2010 17:46:21 +0000</pubDate>
		<guid isPermaLink="false">http://sltaylor.co.uk/?p=149#comment-4594</guid>
		<description>Work a treat !! .. Thanks for sharing.</description>
		<content:encoded><![CDATA[<p>Work a treat !! .. Thanks for sharing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Taylor</title>
		<link>http://sltaylor.co.uk/blog/better-wordpress-pagination/#comment-4348</link>
		<dc:creator>Steve Taylor</dc:creator>
		<pubDate>Sun, 21 Feb 2010 02:53:50 +0000</pubDate>
		<guid isPermaLink="false">http://sltaylor.co.uk/?p=149#comment-4348</guid>
		<description>Pete, could you give a URL to an example where this is happening? The only thing I can guess at from your sample URL is that perhaps the script doesn&#039;t work properly without &quot;pretty &lt;a href=&quot;http://codex.wordpress.org/Using_Permalinks&quot;&gt;permalinks&lt;/a&gt;&quot;. I&#039;m not sure why you wouldn&#039;t have a pretty permalink structure, but if you&#039;re stuck with &quot;ugly&quot; query string-based links---well, it should be easy to adapt. Do post your solution if you need to add anything.</description>
		<content:encoded><![CDATA[<p>Pete, could you give a URL to an example where this is happening? The only thing I can guess at from your sample URL is that perhaps the script doesn&#8217;t work properly without &#8220;pretty <a href="http://codex.wordpress.org/Using_Permalinks">permalinks</a>&#8220;. I&#8217;m not sure why you wouldn&#8217;t have a pretty permalink structure, but if you&#8217;re stuck with &#8220;ugly&#8221; query string-based links&#8212;well, it should be easy to adapt. Do post your solution if you need to add anything.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pete</title>
		<link>http://sltaylor.co.uk/blog/better-wordpress-pagination/#comment-4339</link>
		<dc:creator>Pete</dc:creator>
		<pubDate>Sat, 20 Feb 2010 21:14:58 +0000</pubDate>
		<guid isPermaLink="false">http://sltaylor.co.uk/?p=149#comment-4339</guid>
		<description>Am I the only one that&#039;s get recursive querystring addition when implementing this pagination script?

I have had to alter the make up of the href a little, but the bulk of the code is still the same.

I could really do with a little bit of help with this one.

Eg: http://website/?s=lorem&amp;paged=2&amp;paged=1&amp;paged=3 this just keeps getting longer and longer dependent on how many links are clicked. Am I just going to have to write a string manipulation function to sort this out?</description>
		<content:encoded><![CDATA[<p>Am I the only one that&#8217;s get recursive querystring addition when implementing this pagination script?</p>
<p>I have had to alter the make up of the href a little, but the bulk of the code is still the same.</p>
<p>I could really do with a little bit of help with this one.</p>
<p>Eg: <a href="http://website/?s=lorem&amp;paged=2&amp;paged=1&amp;paged=3">http://website/?s=lorem&amp;paged=2&amp;paged=1&amp;paged=3</a> this just keeps getting longer and longer dependent on how many links are clicked. Am I just going to have to write a string manipulation function to sort this out?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pete</title>
		<link>http://sltaylor.co.uk/blog/better-wordpress-pagination/#comment-4333</link>
		<dc:creator>Pete</dc:creator>
		<pubDate>Sat, 20 Feb 2010 13:09:15 +0000</pubDate>
		<guid isPermaLink="false">http://sltaylor.co.uk/?p=149#comment-4333</guid>
		<description>Works brilliantly. So simple.</description>
		<content:encoded><![CDATA[<p>Works brilliantly. So simple.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Taylor</title>
		<link>http://sltaylor.co.uk/blog/better-wordpress-pagination/#comment-3517</link>
		<dc:creator>Steve Taylor</dc:creator>
		<pubDate>Sat, 09 Jan 2010 14:58:50 +0000</pubDate>
		<guid isPermaLink="false">http://sltaylor.co.uk/?p=149#comment-3517</guid>
		<description>Hi Ayman, you mean the number of total pages? Or to abbreviate the pagination numbers when there&#039;s a lot, like this?

&lt;code&gt;&#171; previous 1 2 3 4 ... 23 24 25 next &#187;&lt;/code&gt;

Abbreviating the pagination numbers is certainly something I&#039;ll try and get round to one day - should be pretty easy. Maybe one of the current pagination plugins does that?

Regarding limiting the total number of pages, these pages should help:

http://weblogtoolscollection.com/archives/2008/04/13/define-your-own-wordpress-loop-using-wp_query/

http://digwp.com/2009/12/limit-posts-without-plugin/</description>
		<content:encoded><![CDATA[<p>Hi Ayman, you mean the number of total pages? Or to abbreviate the pagination numbers when there&#8217;s a lot, like this?</p>
<p><code>&laquo; previous 1 2 3 4 ... 23 24 25 next &raquo;</code></p>
<p>Abbreviating the pagination numbers is certainly something I&#8217;ll try and get round to one day &#8211; should be pretty easy. Maybe one of the current pagination plugins does that?</p>
<p>Regarding limiting the total number of pages, these pages should help:</p>
<p><a href="http://weblogtoolscollection.com/archives/2008/04/13/define-your-own-wordpress-loop-using-wp_query/">http://weblogtoolscollection.com/archives/2008/04/13/define-your-own-wordpress-loop-using-wp_query/</a></p>
<p><a href="http://digwp.com/2009/12/limit-posts-without-plugin/">http://digwp.com/2009/12/limit-posts-without-plugin/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ayman</title>
		<link>http://sltaylor.co.uk/blog/better-wordpress-pagination/#comment-3507</link>
		<dc:creator>ayman</dc:creator>
		<pubDate>Sat, 09 Jan 2010 01:36:14 +0000</pubDate>
		<guid isPermaLink="false">http://sltaylor.co.uk/?p=149#comment-3507</guid>
		<description>how can i limit number of pages that displayed ?not all pages</description>
		<content:encoded><![CDATA[<p>how can i limit number of pages that displayed ?not all pages</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Valid Information</title>
		<link>http://sltaylor.co.uk/blog/better-wordpress-pagination/#comment-2428</link>
		<dc:creator>Valid Information</dc:creator>
		<pubDate>Wed, 11 Nov 2009 10:38:14 +0000</pubDate>
		<guid isPermaLink="false">http://sltaylor.co.uk/?p=149#comment-2428</guid>
		<description>Looks complicated but very useful information</description>
		<content:encoded><![CDATA[<p>Looks complicated but very useful information</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Taylor</title>
		<link>http://sltaylor.co.uk/blog/better-wordpress-pagination/#comment-1148</link>
		<dc:creator>Steve Taylor</dc:creator>
		<pubDate>Mon, 24 Aug 2009 20:29:56 +0000</pubDate>
		<guid isPermaLink="false">http://sltaylor.co.uk/?p=149#comment-1148</guid>
		<description>Hi Sean, from the code you posted it&#039;s not really clear what your issue is. Could you be more specific as to what the issue is? (Please don&#039;t post more code unless necessary, it needed a lot of tidying up!)

If you don&#039;t understand the code enough to explain what the problem is, you might be better off with a plugin - check out the link at the top of this post.</description>
		<content:encoded><![CDATA[<p>Hi Sean, from the code you posted it&#8217;s not really clear what your issue is. Could you be more specific as to what the issue is? (Please don&#8217;t post more code unless necessary, it needed a lot of tidying up!)</p>
<p>If you don&#8217;t understand the code enough to explain what the problem is, you might be better off with a plugin &#8211; check out the link at the top of this post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sean</title>
		<link>http://sltaylor.co.uk/blog/better-wordpress-pagination/#comment-1147</link>
		<dc:creator>sean</dc:creator>
		<pubDate>Mon, 24 Aug 2009 20:19:29 +0000</pubDate>
		<guid isPermaLink="false">http://sltaylor.co.uk/?p=149#comment-1147</guid>
		<description>Hello, I&#039;m trying to improve my search.php page with your code. No more than 5 posts should be displayed per page.

Here&#039;s the code before yours was added:

&lt;code&gt;&lt;a href=&quot;&quot; title=&quot;&quot;&gt;&lt;/a&gt;
Brand:  &lt;!-- End of Byline Containing Div --&gt;
&lt;a href=&quot;&quot; title=&quot;&quot;&gt;more...&lt;/a&gt;&lt;/code&gt;

Here&#039;s how I&#039;ve added yours:

&lt;code&gt;
query_vars[&quot;paged&quot;];
	if ( !$page ) $page = 1;
	$qs = $_SERVER[&quot;QUERY_STRING&quot;] ? &quot;?&quot;.$_SERVER[&quot;QUERY_STRING&quot;] : &quot;&quot;;
	// Only necessary if there&#039;s more posts than posts-per-page
	if ( $query-&gt;found_posts &gt; $query-&gt;query_vars[&quot;posts_per_page&quot;] ) {
		echo &#039;&#039;;
		// Previous link?
		if ( $page &gt; 1 ) {
			echo &#039;&lt;a href=&quot;&#039;.$baseURL.&#039;page/&#039;.($page-1).&#039;/&#039;.$qs.&#039;&quot; rel=&quot;nofollow&quot;&gt;« previous&lt;/a&gt;&#039;;
		}
		// Loop through pages
		for ( $i=1; $i max_num_pages; $i++ ) {
			// Current page or linked page?
			if ( $i == $page ) {
				echo &#039;&#039;.$i.&#039;&#039;;
			} else {
				echo &#039;&lt;a href=&quot;&#039;.$baseURL.&#039;page/&#039;.$i.&#039;/&#039;.$qs.&#039;&quot; rel=&quot;nofollow&quot;&gt;&#039;.$i.&#039;&lt;/a&gt;&#039;;
			}
		}
		// Next link?
		if ( $page max_num_pages ) {
			echo &#039;&lt;a href=&quot;&#039;.$baseURL.&#039;page/&#039;.($page+1).&#039;/&#039;.$qs.&#039;&quot; rel=&quot;nofollow&quot;&gt;next »&lt;/a&gt;&#039;;
		}
		echo &#039;&#039;;
	}
} ?&gt;
                
&lt;a href=&quot;&quot; title=&quot;&quot;&gt;&lt;/a&gt;
Brand:  &lt;!-- End of Byline Containing Div --&gt;
&lt;a href=&quot;&quot; title=&quot;&quot;&gt;more...&lt;/a&gt;

No Results Found
Please try your search again using different keywords. 
&lt;/code&gt;

This is my first attempt at pagination, but I&#039;ve used Wordpress for 5-6 projects now.</description>
		<content:encoded><![CDATA[<p>Hello, I&#8217;m trying to improve my search.php page with your code. No more than 5 posts should be displayed per page.</p>
<p>Here&#8217;s the code before yours was added:</p>
<p><code>&lt;a href=&quot;" title=""&gt;&lt;/a&gt;<br />
Brand:  &lt;!-- End of Byline Containing Div --&gt;<br />
&lt;a href=&quot;" title=""&gt;more...&lt;/a&gt;</code></p>
<p>Here&#8217;s how I&#8217;ve added yours:</p>
<p><code><br />
query_vars["paged"];<br />
	if ( !$page ) $page = 1;<br />
	$qs = $_SERVER["QUERY_STRING"] ? "?".$_SERVER["QUERY_STRING"] : "";<br />
	// Only necessary if there's more posts than posts-per-page<br />
	if ( $query-&gt;found_posts &gt; $query-&gt;query_vars["posts_per_page"] ) {<br />
		echo '';<br />
		// Previous link?<br />
		if ( $page &gt; 1 ) {<br />
			echo '&lt;a href="'.$baseURL.'page/'.($page-1).'/'.$qs.'" rel="nofollow"&gt;« previous&lt;/a&gt;';<br />
		}<br />
		// Loop through pages<br />
		for ( $i=1; $i max_num_pages; $i++ ) {<br />
			// Current page or linked page?<br />
			if ( $i == $page ) {<br />
				echo ''.$i.'';<br />
			} else {<br />
				echo '&lt;a href="'.$baseURL.'page/'.$i.'/'.$qs.'" rel="nofollow"&gt;'.$i.'&lt;/a&gt;';<br />
			}<br />
		}<br />
		// Next link?<br />
		if ( $page max_num_pages ) {<br />
			echo '&lt;a href="'.$baseURL.'page/'.($page+1).'/'.$qs.'" rel="nofollow"&gt;next »&lt;/a&gt;';<br />
		}<br />
		echo '';<br />
	}<br />
} ?&gt;</p>
<p>&lt;a href=&quot;" title=""&gt;&lt;/a&gt;<br />
Brand:  &lt;!-- End of Byline Containing Div --&gt;<br />
&lt;a href=&quot;" title=""&gt;more...&lt;/a&gt;</p>
<p>No Results Found<br />
Please try your search again using different keywords.<br />
</code></p>
<p>This is my first attempt at pagination, but I&#8217;ve used Wordpress for 5-6 projects now.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Taylor</title>
		<link>http://sltaylor.co.uk/blog/better-wordpress-pagination/#comment-160</link>
		<dc:creator>Steve Taylor</dc:creator>
		<pubDate>Sat, 11 Jul 2009 12:49:19 +0000</pubDate>
		<guid isPermaLink="false">http://sltaylor.co.uk/?p=149#comment-160</guid>
		<description>Tim, you would just call the function where you want the pagination controls. The basic call (say, after The Loop in &lt;code&gt;index.php&lt;/code&gt;) would be:

&lt;code&gt;pagination( $wp_query, &quot;/&quot; );&lt;/code&gt;

If often include one before The Loop too, but set to only appear if not on the first page:

&lt;code&gt;if ( $paged ) slt_pagination( $wp_query, &quot;/&quot; );&lt;/code&gt;

For &lt;code&gt;archive.php&lt;/code&gt;, you&#039;ll probably have to set up the &lt;code&gt;$baseURL&lt;/code&gt; parameter dynamically, depending on the type of archive being shown. (Hint: the WP functions &lt;code&gt;get_category_link()&lt;/code&gt; and &lt;code&gt;get_month_link()&lt;/code&gt; help out a lot!)

If you&#039;re not following, then it&#039;s possible that &lt;a href=&quot;http://www.seoegghead.com/software/wordpress-seo-pager.seo&quot; rel=&quot;nofollow&quot;&gt;a plugin&lt;/a&gt; might be your cup of tea. For the most part I&#039;m addressing theme developers here.

Good luck!</description>
		<content:encoded><![CDATA[<p>Tim, you would just call the function where you want the pagination controls. The basic call (say, after The Loop in <code>index.php</code>) would be:</p>
<p><code>pagination( $wp_query, "/" );</code></p>
<p>If often include one before The Loop too, but set to only appear if not on the first page:</p>
<p><code>if ( $paged ) slt_pagination( $wp_query, "/" );</code></p>
<p>For <code>archive.php</code>, you&#8217;ll probably have to set up the <code>$baseURL</code> parameter dynamically, depending on the type of archive being shown. (Hint: the WP functions <code>get_category_link()</code> and <code>get_month_link()</code> help out a lot!)</p>
<p>If you&#8217;re not following, then it&#8217;s possible that <a href="http://www.seoegghead.com/software/wordpress-seo-pager.seo">a plugin</a> might be your cup of tea. For the most part I&#8217;m addressing theme developers here.</p>
<p>Good luck!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
