<?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>Gregory Grubbs &#187; admin</title>
	<atom:link href="http://gregorygrubbs.com/tag/admin/feed/" rel="self" type="application/rss+xml" />
	<link>http://gregorygrubbs.com</link>
	<description>Attention in software development</description>
	<lastBuildDate>Mon, 12 Jul 2010 17:35:34 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to change the number of posts shown in the WordPress admin area without hacking the core</title>
		<link>http://gregorygrubbs.com/wordpress/how-to-change-the-number-of-posts-shown-in-the-wordpress-admin-area-without-hacking-the-core/</link>
		<comments>http://gregorygrubbs.com/wordpress/how-to-change-the-number-of-posts-shown-in-the-wordpress-admin-area-without-hacking-the-core/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 13:24:49 +0000</pubDate>
		<dc:creator>Gregory Grubbs</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[edit posts]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[hook]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://gregorygrubbs.com/?p=142</guid>
		<description><![CDATA[It is easy to go in and hack the core WordPress files to change the hard-coded number, but I wanted to find a way to do it with a hook.  That way, I could one day change the number of posts shown using controls in the interface.
Though there is no filter provided for the number [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_154" class="wp-caption alignnone" style="width: 510px"><img class="size-full wp-image-154" title="use the hook!" src="http://gregorygrubbs.com/wp-content/uploads/2009/03/2921148701_6d1985e27f-cropped.jpg" alt="use the hook!" width="500" height="248" /><p class="wp-caption-text">use the hook!</p></div>
<p>It is easy to go in and hack the core WordPress files to change the hard-coded number, but I wanted to find a way to do it with a hook.  That way, I could one day change the number of posts shown using controls in the interface.</p>
<p>Though there is no filter provided for the number of posts displayed, I hit upon a method of doing this which I would like to share.  Perhaps someone will point out a better way, but for now this is making me happy</p>
<p>The trick is to hijack the query string just for the query that produces the table of posts.  Here&#8217;s what I did:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**  * Extend the number of posts displayed in the Edit Posts  */</span> 
<span style="color: #000000; font-weight: bold;">function</span> dapl_query_string<span style="color: #009900;">&#40;</span><span style="color: #000088;">$query_string</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>   
    <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$pagenow</span><span style="color: #339933;">;</span>   
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>is_admin<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$pagenow</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'edit.php'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$query_string</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'posts_per_page=15'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'posts_per_page=100'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$query_string</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$query_string</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span>  
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'query_string'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'dapl_query_string'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://gregorygrubbs.com/wordpress/how-to-change-the-number-of-posts-shown-in-the-wordpress-admin-area-without-hacking-the-core/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
